Simulating time evolution

Simulating time evolution#

In this subsection, we detail the workflow for simulating the time evolution of a quantum system using common function “Evolve”. Our focus is on implementing a Cross-resonance (CR) pulse in a system of three qubits. The code provided forms the basis of our discussion.

Initially, we set up the pulse parameters for our time evolution. We specify the length of the CR pulse and calculate the effective coupling strength \(J_{eff}\) and the detuning between the dressed 0-1 frequencies of qubits 1 and 2. The driving amplitude of the pulse \(\epsilon_d\) is computed based on the detuning and the effective coupling strength.

[1]:
import numpy as np
import jax
import jax.numpy as jnp
import matplotlib.pyplot as plt

fluxonium_1 = {
    "ec": 1.0 * 2 * np.pi,
    "ej": 4.0 * 2 * np.pi,
    "el": 0.9 * 2 * np.pi,
    "phiext": np.pi,
    "system_type": "fluxonium",
    "arguments": {"phi_max": 5 * np.pi},
}

fluxonium_2 = {
    "ec": 1.0 * 2 * np.pi,
    "ej": 4.0 * 2 * np.pi,
    "el": 1.0 * 2 * np.pi,
    "phiext": np.pi,
    "system_type": "fluxonium",
    "arguments": {"phi_max": 5 * np.pi},
}

fluxonium_3 = {
    "ec": 1.0 * 2 * np.pi,
    "ej": 4.0 * 2 * np.pi,
    "el": 1.1 * 2 * np.pi,
    "phiext": np.pi,
    "system_type": "fluxonium",
    "arguments": {"phi_max": 5 * np.pi},
}

coupling = {
    "capacitive_coupling": {"strength": 20.0e-3 * 2 * np.pi},
    "inductive_coupling": {"strength": -1.0 * 2e-3 * 2 * np.pi},
}

[2]:
from supergrad.scgraph.graph import SCGraph


class MultipathThreeQubit(SCGraph):
    def __init__(self):
        super().__init__()

        # nodes represent qubits
        self.add_node("q1", **fluxonium_1)
        self.add_node("q2", **fluxonium_2)
        self.add_node("q3", **fluxonium_3)
        # edges represent two-qubit interactions
        self.add_edge("q1", "q2", **coupling)
        self.add_edge("q2", "q3", **coupling)

[3]:
from supergrad.helper import Spectrum


chain_3q = MultipathThreeQubit()
spec = Spectrum(chain_3q, share_params=True, unify_coupling=True)
params = spec.all_params
energy = spec.energy_tensor(params)
dressed_freq_q1 = (energy[1, 0, 0] - energy[0, 0, 0])
dressed_freq_q2 = (energy[0, 1, 0] - energy[0, 0, 0])

[4]:
from supergrad.helper import Evolve
from supergrad.utils import tensor, compute_fidelity_with_1q_rotation_axis
from supergrad.utils.gates import cnot

length = 100.0
detuning = jnp.abs(dressed_freq_q1 - dressed_freq_q2)
j_eff = 0.01 * 2 * np.pi
tau_eps_drive = np.pi / 2.0 * detuning / j_eff

cr_pulse = {
    "pulse": {
        "amp": tau_eps_drive / length,
        "omega_d": dressed_freq_q2,
        "phase": 0.0,
        "length": length,
        "pulse_type": "cos",
        "operator_type": "phi_operator",
        "delay": 0.0,
    }
}

cr_chain_3q = MultipathThreeQubit()
cr_chain_3q.add_node("q1", **cr_pulse)

The Evolve class is then utilized to simulate the time evolution. We specify parameters such as the truncated dimension, parameter sharing, and compensation options. The unitary evolution of the CR pulse is computed using the eigen_basis method of the Evolve class.

[5]:
target_unitary = tensor(cnot(), jnp.eye(2))
evo = Evolve(cr_chain_3q, truncated_dim=3, share_params=True, unify_coupling=True, compensation_option='no_comp')
params = evo.pulse_params
cr_unitary = evo.eigen_basis(evo.all_params)
fideity, res_unitary = compute_fidelity_with_1q_rotation_axis(target_unitary, cr_unitary, compensation_option='arbit_single')
print(fideity)  # 0.98824

0.9882389768200248

The CR pulse, which contains an effective ZX term, can be utilized to implement a CNOT unitary. It is well-established that single-qubit gates generally exhibit lower error rates compared to two-qubit gates. Therefore, we can introduce virtual single-qubit rotations to simulate a CNOT unitary more accurately. For instance, we simulate a 3-qubit gate that is composed of a tensor product between a CNOT gate and an identity operation, and the possible compensations are calculated using a differentiable optimizer within the compute_fidelity_with_1q_rotation_axis function. Additionally, we compute the fidelity of the resultant unitary against the target unitary. The high fidelity(0.98824) indicates a successful implementation of the CNOT gate, demonstrating the effectiveness of our approach in simulating quantum gate operations in a multi-qubit system.

Furthermore, we conduct pulse parameter optimization to simulate device calibration. This optimization process utilizes automatic differentiation to obtain gradients. After optimization, the fidelity of the \(CNOT\otimes I\) gate is significantly enhanced, reaching up to 99.99%. Consider the following code as an example:

[6]:
import haiku as hk
from supergrad.utils.optimize import scipy_minimize

def infidelity(params):
    params = hk.data_structures.merge(evo.all_params, params)
    cr_unitary = evo.eigen_basis(params)
    fideity, res_unitary = compute_fidelity_with_1q_rotation_axis(target_unitary, cr_unitary, compensation_option='arbit_single')
    return jnp.abs(1 - fideity)

scipy_minimize(infidelity, params, method='L-BFGS-B', logging=True)

/Users/allegro/anaconda3/envs/supergrad/lib/python3.10/site-packages/jax/_src/lax/lax.py:3480: ComplexWarning: Casting complex values to real discards the imaginary part
  x_bar = _convert_element_type(x_bar, x.aval.dtype, x.aval.weak_type)
step: 0
parameters:
{ 'q1_pulse_cos': { 'amp': 0.1306765363337767,
                    'length': 100.0,
                    'omega_d': 3.6580304111481468,
                    'phase': 0.0}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.8716495664108874,
                    'length': -0.0013367213466302676,
                    'omega_d': -1.044309752642255,
                    'phase': -0.017923482331139683}}
loss: 0.011761
step: 1
parameters:
{ 'q1_pulse_cos': { 'amp': 0.7714084942392794,
                    'length': 100.00098259681253,
                    'omega_d': 4.425681378067649,
                    'phase': 0.013175189168971941}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.0009205993745218244,
                    'length': 0.0014138482311617248,
                    'omega_d': 0.026306118112769783,
                    'phase': 0.0001223665803978625}}
loss: 0.444792
step: 2
parameters:
{ 'q1_pulse_cos': { 'amp': 0.2618461554284559,
                    'length': 100.000201155644,
                    'omega_d': 3.8151826862705684,
                    'phase': 0.002697203602023658}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.1993395484413036,
                    'length': 0.0014522552573166853,
                    'omega_d': 1.2237246401746542,
                    'phase': -0.008804262165025374}}
loss: 0.396088
step: 3
parameters:
{ 'q1_pulse_cos': { 'amp': 0.1435970286924781,
                    'length': 100.00001981426782,
                    'omega_d': 3.673510251555445,
                    'phase': 0.00026568041266212774}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.6501313018198867,
                    'length': -0.001135481467742394,
                    'omega_d': -0.11659806305162636,
                    'phase': -0.014544924008140604}}
loss: 0.007559
step: 4
parameters:
{ 'q1_pulse_cos': { 'amp': 0.16515401648143863,
                    'length': 100.0000570485965,
                    'omega_d': 3.6793654448198088,
                    'phase': 0.0007444264141907009}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.2844763849865306,
                    'length': -0.0005482057485491546,
                    'omega_d': 0.1360614065335545,
                    'phase': -0.007429402805319423}}
loss: 0.001931
step: 5
parameters:
{ 'q1_pulse_cos': { 'amp': 0.18117059269775979,
                    'length': 100.00008696431588,
                    'omega_d': 3.677306578454814,
                    'phase': 0.001166040772185648}}
gradient:
{ 'q1_pulse_cos': { 'amp': 0.11837621887436409,
                    'length': 0.0002685071280263602,
                    'omega_d': -0.06259063687595931,
                    'phase': 0.0032706546553792296}}
loss: 0.000378
step: 6
parameters:
{ 'q1_pulse_cos': { 'amp': 0.17647883220344665,
                    'length': 100.00007724665544,
                    'omega_d': 3.6779850121336883,
                    'phase': 0.0010383431976684358}}
gradient:
{ 'q1_pulse_cos': { 'amp': 0.0014160664931791205,
                    'length': 2.1814025438545853e-05,
                    'omega_d': -0.001149806115935925,
                    'phase': 6.464862213143619e-05}}
loss: 0.000024
step: 7
parameters:
{ 'q1_pulse_cos': { 'amp': 0.17642337915623157,
                    'length': 100.00007649577566,
                    'omega_d': 3.678000291620762,
                    'phase': 0.001035968589456474}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.00033152679851690403,
                    'length': 1.8283828681883413e-05,
                    'omega_d': -0.0002386365705977409,
                    'phase': 1.7217405576625976e-05}}
loss: 0.000024
step: 8
parameters:
{ 'q1_pulse_cos': { 'amp': 0.17643423559505048,
                    'length': 100.0000760422241,
                    'omega_d': 3.678004978454606,
                    'phase': 0.0010356054320518919}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.00037969942642217475,
                    'length': 1.2146643342507349e-06,
                    'omega_d': -0.000658382326569321,
                    'phase': 1.521397746690818e-05}}
loss: 0.000024
step: 9
parameters:
{ 'q1_pulse_cos': { 'amp': 0.17647766135032608,
                    'length': 100.00007422801784,
                    'omega_d': 3.6780237257899806,
                    'phase': 0.0010341528024335632}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.0002785507919523555,
                    'length': 1.8338750068025756e-05,
                    'omega_d': -0.00026787131779645043,
                    'phase': 1.8571636882160825e-05}}
loss: 0.000024
step: 10
parameters:
{ 'q1_pulse_cos': { 'amp': 0.176541543313869,
                    'length': 100.00007155920858,
                    'omega_d': 3.6780513042762344,
                    'phase': 0.0010320158946991894}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.0002670742112346747,
                    'length': 1.6085282518912494e-06,
                    'omega_d': -0.0007190058579767821,
                    'phase': 1.8178361091789557e-05}}
loss: 0.000024
step: 11
parameters:
{ 'q1_pulse_cos': { 'amp': 0.17679707116804078,
                    'length': 100.00006088397151,
                    'omega_d': 3.6781616182212504,
                    'phase': 0.0010234682637616944}}
gradient:
{ 'q1_pulse_cos': { 'amp': -5.682890752443503e-06,
                    'length': 1.8356168435303657e-05,
                    'omega_d': -0.00042756680353961624,
                    'phase': 2.5444593031217922e-05}}
loss: 0.000024
step: 12
parameters:
{ 'q1_pulse_cos': { 'amp': 0.17712792261303245,
                    'length': 100.00003613144303,
                    'omega_d': 3.678351564732654,
                    'phase': 0.0009977838962285039}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.001884640171686438,
                    'length': 1.397850638351052e-05,
                    'omega_d': 0.0006221710289697176,
                    'phase': -2.661954985526098e-05}}
loss: 0.000024
step: 13
parameters:
{ 'q1_pulse_cos': { 'amp': 0.17845132839299915,
                    'length': 99.99993712132907,
                    'omega_d': 3.679111350778269,
                    'phase': 0.0008950464260957418}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.01072395616603148,
                    'length': -7.129736403400999e-06,
                    'omega_d': 0.006633935678440414,
                    'phase': -0.0002763431934604163}}
loss: 0.000024
step: 14
parameters:
{ 'q1_pulse_cos': { 'amp': 0.1772240387219839,
                    'length': 100.00002894055189,
                    'omega_d': 3.6784067463552867,
                    'phase': 0.0009903222952425057}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.0024538305709499307,
                    'length': 1.2691572552364597e-05,
                    'omega_d': 0.0009587812159156932,
                    'phase': -4.246630163808258e-05}}
loss: 0.000023
step: 15
parameters:
{ 'q1_pulse_cos': { 'amp': 0.17732693480345946,
                    'length': 100.0000212424196,
                    'omega_d': 3.6784658204563954,
                    'phase': 0.0009823343574101348}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.003075734847238367,
                    'length': 1.1263673435530435e-05,
                    'omega_d': 0.0013349875539320987,
                    'phase': -5.981863090906137e-05}}
loss: 0.000023
step: 16
parameters:
{ 'q1_pulse_cos': { 'amp': 0.1778891315982293,
                    'length': 99.99997918187434,
                    'omega_d': 3.6787885856173324,
                    'phase': 0.0009386903917529384}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.0067138297961977355,
                    'length': 2.5396570649001145e-06,
                    'omega_d': 0.0037038108111191676,
                    'phase': -0.00016210781853965583}}
loss: 0.000023
step: 17
parameters:
{ 'q1_pulse_cos': { 'amp': 0.17740925232303312,
                    'length': 100.00001508386482,
                    'omega_d': 3.678513080112979,
                    'phase': 0.0009759439563429606}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.003580891702071266,
                    'length': 1.0142108301658801e-05,
                    'omega_d': 0.0016486166892331333,
                    'phase': -7.393632722953553e-05}}
loss: 0.000023
step: 18
parameters:
{ 'q1_pulse_cos': { 'amp': 0.17748261426165213,
                    'length': 100.00000959531852,
                    'omega_d': 3.678555198243401,
                    'phase': 0.0009702487870367317}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.004036264456995071,
                    'length': 9.149613242736395e-06,
                    'omega_d': 0.0019369899491126833,
                    'phase': -8.6688968974175e-05}}
loss: 0.000023
step: 19
parameters:
{ 'q1_pulse_cos': { 'amp': 0.17768587292994073,
                    'length': 99.99999438859643,
                    'omega_d': 3.6786718919303665,
                    'phase': 0.000954469589394835}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.0053416992599546465,
                    'length': 5.958365937325975e-06,
                    'omega_d': 0.002780832220578324,
                    'phase': -0.00012339715950859305}}
loss: 0.000023
step: 20
parameters:
{ 'q1_pulse_cos': { 'amp': 0.17771956661197189,
                    'length': 99.99999186781606,
                    'omega_d': 3.678691235951543,
                    'phase': 0.0009518539111926237}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.005153314627160083,
                    'length': 6.938556868483894e-06,
                    'omega_d': 0.0028602654977155574,
                    'phase': -0.00012031958519505279}}
loss: 0.000023
step: 21
parameters:
{ 'q1_pulse_cos': { 'amp': 0.17768587292994073,
                    'length': 99.99999438859643,
                    'omega_d': 3.6786718919303665,
                    'phase': 0.000954469589394835}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.0053416992599546465,
                    'length': 5.958365937325975e-06,
                    'omega_d': 0.002780832220578324,
                    'phase': -0.00012339715950859305}}
loss: 0.000023
step: 22
parameters:
{ 'q1_pulse_cos': { 'amp': 0.18404922585396413,
                    'length': 99.99972458503993,
                    'omega_d': 3.6814536631558723,
                    'phase': 0.0007355697899315808}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.03823710587977848,
                    'length': -8.06501790698442e-05,
                    'omega_d': 0.0373170584987739,
                    'phase': -0.0011071018647696106}}
loss: 0.000028
step: 23
parameters:
{ 'q1_pulse_cos': { 'amp': 0.1781336736389475,
                    'length': 99.99997540202986,
                    'omega_d': 3.678867650226653,
                    'phase': 0.0009390652127130043}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.005632465806414707,
                    'length': 3.7811555432691927e-06,
                    'omega_d': 0.0030709629582446737,
                    'phase': -0.0001329540547583822}}
loss: 0.000023
step: 24
parameters:
{ 'q1_pulse_cos': { 'amp': 0.1785577796360769,
                    'length': 99.99995742010937,
                    'omega_d': 3.6790530502623677,
                    'phase': 0.0009244759358284384}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.006076530828464051,
                    'length': 1.1991268788244023e-06,
                    'omega_d': 0.0034702544033596494,
                    'phase': -0.00014679616132178406}}
loss: 0.000023
step: 25
parameters:
{ 'q1_pulse_cos': { 'amp': 0.18130350274502052,
                    'length': 99.99984100257466,
                    'omega_d': 3.68025335670912,
                    'phase': 0.0008300228628800096}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.009770564902741152,
                    'length': -1.965916115956518e-06,
                    'omega_d': 0.00804480980055345,
                    'phase': -0.00026528848471753415}}
loss: 0.000022
step: 26
parameters:
{ 'q1_pulse_cos': { 'amp': 0.18153860420978918,
                    'length': 99.99983103436888,
                    'omega_d': 3.6803561324780545,
                    'phase': 0.0008219353555382296}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.010362403223141444,
                    'length': -3.2367573023321356e-06,
                    'omega_d': 0.00871242132980225,
                    'phase': -0.00028353384353447506}}
loss: 0.000022
step: 27
parameters:
{ 'q1_pulse_cos': { 'amp': 0.18130350274502052,
                    'length': 99.99984100257466,
                    'omega_d': 3.68025335670912,
                    'phase': 0.0008300228628800096}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.009770564902741152,
                    'length': -1.965916115956518e-06,
                    'omega_d': 0.00804480980055345,
                    'phase': -0.00026528848471753415}}
loss: 0.000022
step: 28
parameters:
{ 'q1_pulse_cos': { 'amp': 0.1907322992389204,
                    'length': 99.99944227212993,
                    'omega_d': 3.684062779570215,
                    'phase': 0.0005166049225173155}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.04193090328255168,
                    'length': -7.712377833673969e-05,
                    'omega_d': 0.0619466993812611,
                    'phase': -0.0013660187526283113}}
loss: 0.000076
step: 29
parameters:
{ 'q1_pulse_cos': { 'amp': 0.18201798428824487,
                    'length': 99.99981078816249,
                    'omega_d': 3.680542021580225,
                    'phase': 0.0008062731368307297}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.010605363208243294,
                    'length': -3.691169702042348e-06,
                    'omega_d': 0.009257149503128479,
                    'phase': -0.0002929998934707909}}
loss: 0.000022
step: 30
parameters:
{ 'q1_pulse_cos': { 'amp': 0.18145126275519655,
                    'length': 99.99983475401318,
                    'omega_d': 3.6803130547162923,
                    'phase': 0.0008251112457836701}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.009920426925087829,
                    'length': -2.277733013640287e-06,
                    'omega_d': 0.008269078756472826,
                    'phase': -0.0002703267117157269}}
loss: 0.000022
step: 31
parameters:
{ 'q1_pulse_cos': { 'amp': 0.1815678637402687,
                    'length': 99.99982982312272,
                    'omega_d': 3.6803601638524848,
                    'phase': 0.0008212353703621132}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.012864846792349635,
                    'length': -1.722247931639283e-05,
                    'omega_d': 0.010428992584530934,
                    'phase': -0.0003541280284790614}}
loss: 0.000022
step: 32
parameters:
{ 'q1_pulse_cos': { 'amp': 0.18167014660102268,
                    'length': 99.99982549772545,
                    'omega_d': 3.6804014881793283,
                    'phase': 0.0008178354365982806}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.010164277589742232,
                    'length': -2.7739594213407123e-06,
                    'omega_d': 0.008627039953784148,
                    'phase': -0.000278443428428783}}
loss: 0.000022
step: 33
parameters:
{ 'q1_pulse_cos': { 'amp': 0.18189971947458933,
                    'length': 99.9998157894139,
                    'omega_d': 3.6804942402239202,
                    'phase': 0.000810204318751697}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.010448155580522825,
                    'length': -3.372165710289387e-06,
                    'omega_d': 0.00902246613952384,
                    'phase': -0.00028798616862390553}}
loss: 0.000022
step: 34
parameters:
{ 'q1_pulse_cos': { 'amp': 0.18171774006631472,
                    'length': 99.99982348506524,
                    'omega_d': 3.6804207168937073,
                    'phase': 0.0008162534058612502}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.010220838193268373,
                    'length': -2.895162668866277e-06,
                    'omega_d': 0.008708864228906318,
                    'phase': -0.00028031484462573235}}
loss: 0.000022
step: 35
parameters:
{ 'q1_pulse_cos': { 'amp': 0.18175536853266872,
                    'length': 99.99982189381072,
                    'omega_d': 3.6804359195486858,
                    'phase': 0.0008150026167036617}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.01026641082777225,
                    'length': -2.99050657327707e-06,
                    'omega_d': 0.008774702217861276,
                    'phase': -0.00028181964221406935}}
loss: 0.000022
step: 36
parameters:
{ 'q1_pulse_cos': { 'amp': 0.18171774006631472,
                    'length': 99.99982348506524,
                    'omega_d': 3.6804207168937073,
                    'phase': 0.0008162534058612502}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.010220838193268373,
                    'length': -2.895162668866277e-06,
                    'omega_d': 0.008708864228906318,
                    'phase': -0.00028031484462573235}}
loss: 0.000022
step: 37
parameters:
{ 'q1_pulse_cos': { 'amp': 0.19136199988335256,
                    'length': 99.9994154911831,
                    'omega_d': 3.6842789479697893,
                    'phase': 0.0004962904679156459}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.04242415747573319,
                    'length': -7.895381994104896e-05,
                    'omega_d': 0.06556291254913324,
                    'phase': -0.001381528784875153}}
loss: 0.000081
step: 38
parameters:
{ 'q1_pulse_cos': { 'amp': 0.18245749923407614,
                    'length': 99.99979219005448,
                    'omega_d': 3.6807166609955897,
                    'phase': 0.0007917107741632752}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.014057091862817474,
                    'length': -1.795079608800636e-05,
                    'omega_d': 0.01237385317059526,
                    'phase': -0.0003946895016994005}}
loss: 0.000022
step: 39
parameters:
{ 'q1_pulse_cos': { 'amp': 0.18185198202881042,
                    'length': 99.9998178060499,
                    'omega_d': 3.6804744210162883,
                    'phase': 0.0008117997252750194}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.010362912085262972,
                    'length': -3.1855785228747854e-06,
                    'omega_d': 0.00890802608666947,
                    'phase': -0.0002853505016086139}}
loss: 0.000022
step: 40
parameters:
{ 'q1_pulse_cos': { 'amp': 0.18174600455325554,
                    'length': 99.99982228935525,
                    'omega_d': 3.680432024233403,
                    'phase': 0.000815315688664423}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.013117096826041865,
                    'length': -1.7470090463242725e-05,
                    'omega_d': 0.01081336016844002,
                    'phase': -0.0003625492618717626}}
loss: 0.000022
step: 41
parameters:
{ 'q1_pulse_cos': { 'amp': 0.18177053847762908,
                    'length': 99.99982125146418,
                    'omega_d': 3.6804418391441613,
                    'phase': 0.0008145017385354533}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.01027562811726828,
                    'length': -3.008820227721283e-06,
                    'omega_d': 0.008767428421535202,
                    'phase': -0.00028251816134010723}}
loss: 0.000022
step: 42
parameters:
{ 'q1_pulse_cos': { 'amp': 0.18175162415940727,
                    'length': 99.99982205162162,
                    'omega_d': 3.6804342723830277,
                    'phase': 0.0008151292497122876}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.013129253400689283,
                    'length': -1.7481594833346574e-05,
                    'omega_d': 0.01082958045442714,
                    'phase': -0.00036294073200024695}}
loss: 0.000022
step: 43
parameters:
{ 'q1_pulse_cos': { 'amp': 0.1817471121973268,
                    'length': 99.99982224249712,
                    'omega_d': 3.6804324673515745,
                    'phase': 0.0008152789408934204}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.013122128863038915,
                    'length': -1.747987958163823e-05,
                    'omega_d': 0.010818921314546988,
                    'phase': -0.00036270485979730734}}
loss: 0.000022
step: 44
parameters:
{ 'q1_pulse_cos': { 'amp': 0.18174600455325554,
                    'length': 99.99982228935525,
                    'omega_d': 3.680432024233403,
                    'phase': 0.000815315688664423}}
gradient:
{ 'q1_pulse_cos': { 'amp': -0.013117096826041865,
                    'length': -1.7470090463242725e-05,
                    'omega_d': 0.01081336016844002,
                    'phase': -0.0003625492618717626}}
loss: 0.000022
[6]:
  message: CONVERGENCE: REL_REDUCTION_OF_F_<=_FACTR*EPSMCH
  success: True
   status: 0
      fun: 2.1932119055434462e-05
        x: q1_pulse_cos:     amp: 0.18174600455325554
                          length: 99.99982228935525
                         omega_d: 3.680432024233403
                           phase: 0.000815315688664423
      nit: 10
      jac: q1_pulse_cos:     amp: -0.013117096826041865
                          length: -1.7470090463242725e-05
                         omega_d: 0.01081336016844002
                           phase: -0.0003625492618717626
     nfev: 45
     njev: 45
 hess_inv: <4x4 LbfgsInvHessProduct with dtype=float64>