HiQ Pulse is a universal control pulse design software developed for NISQ quantum hardware control. It contains common known control pulse and algorithm libraries. HiQ Pulse can provide users with desired pulse sequences for target quantum state preparation, quantum logic gates, and physical implementation of quantum circuits. Additionally, HiQ Pulse provides online pulse design on HUAWEI CLOUD.
For optimal using of algorithm number of threads should be limited
At first step, system should be created and optimizer is selected as GRAPEOptimizer in grape class in this example here.
1)Import the modules required for the calculation
As dependent packages, projectq is imported to generate quantum gate/circuit and Qutip is often used to generate quantum operators.
2) Define target quantum circuit
3) Define the hamitonian of quantum system
Here, we define a system hamiltonian class of 12 qubits transmon quantum chip of which parameters obtained by citing PhysRevLett.122.110501. For optimization tasks you can use your own Qobj operators and state vectors. TransmonHam class is used to create drift and control hamiltonian.
4) Parameters and Optimizer
Parameters in Optim:
Hd: Qobj operator, drift hamiltonian of system.
Hc: List of Qobj operators, control hamiltonians.
n_ctrls: int, number of time steps
T: double, evolution end time
phase: string, choose phase option. Posible values:
init_controls: np.array with shape (n_tslots, len(h_c)).
labels: List of strings, that names each control
mem_iterations: bool, set True if you need to save control functions at each optimization iteration. Not recomended for big task due to large memory usage. Default is False
comp_type: string, choose computer type. Posible values:
'expm' - uses exponential matrix to calculate propagation and first order formula to calculate gradient
'hord' - uses exponential matrix to calculate propagation and second order formula to calculate gradient
'ode' - uses Runge-Kutta ode solver to calculate propagation and first order gradient formula. Currently not supported
Due to not a big difference in time of calculation between 'expm' and 'hord' and because of faster convergence using second order gradient, it's recommended to use 'hord' option Default is 'hord'
max_funcalls: int, max number of propagation function calls. Optimizer will stop when reach this number. Default is numpy.inf
max_nit: int, max number of optimizer iterations. Default is numpy.inf
optimizer: string, sets optimizer type. Currently implemented 'l-bfgs-b' and 'bfgs' algorythms, but it is recommended to use 'l-bfgs-b' option. Default is 'l-bfgs-b'
pgtol: double, value of projected gradient. if pg value at iteration is less than setted pgtol, optimization will stops. Works for 'l-bfgs-b' and 'bfgs' options. Default is 10−1010−10
ftarg: double, target fidelity error value. Optimizer iterations will stop when error reaches this value. If not setted, optimizer will stop optimization using its own exit conditions. Default is None
Result object values: