Posts

Showing posts from June, 2019

Noise in the circuit processor

Image
It was suggested that we separate the noise from the circuit processor. So I decided to first make it clear where does the noise play a role in our model and try to find a good way to define a noise object. In the simulation, I find two places to introduce noise: The first one is the collapse operator, it has been an important part of the open system solver from the beginning of QuTiP and can be naturally added into our simulation. the T1 and T2 time added recently is basically just a wrap for it. Noise from the instrument. Parameters like a detuned frequency can be simulated by simply perturbing it in the definition of  cqed and spinchain The first one is quite clear, what I'm not sure about is the second one. Two issues: How should we define this perturbation in a separate noise object? To represent the noise in the instruments, I'm thinking of a time-dependent experiment parameter (e.g. frequency, interaction strength etc). Like we now have for the amplitude, it w...

Refatoring the circuit processor and noise simulation

Image
The main tasks of the last two weeks were refactoring the existing code and finding a way to simulate noise. The original CircuiProcessor class is now the base class calling the open system solver and calculating the numerical evolution. On top of this, the subclasses determine how to find the driving pulses for a given quantum circuit. We aimed at bring other part of the code in qip under the same structure described in  the previous post . so that the class structure looks like: CircuitProcessor ├── ModelProcessor │ ├── DispersivecQED │ └── SpinChain └── OptPulseProcessor There are two main parts of the refactoring. First, cqed and   spinchain were designed for specific models, each Hamiltonian operator and control pulse amplitude has a separate attribute in the class. To unify the representation, I used the property decorator in Python to link them to the two main attributes ctrls and amps , to be consistent with the parent class  circuitproc...

Demo for user defined gates

User defined gate In [1]: from qutip import * import numpy as np User defined gates ¶ This demo is based on the branch https://github.com/BoxiLi/qutip/tree/user_gate A user defined gate can be specified by a python function that takes at most one parameter and return a Qobj , the dimension of the Qobj has to match the qubit system. In [2]: def user_gate1 ( arg_values ): # controlled rotation X mat = np . zeros (( 4 , 4 ), dtype = np . complex ) mat [ 0 , 0 ] = mat [ 1 , 1 ] = 1. mat [ 2 : 4 , 2 : 4 ] = rx ( arg_values ) return Qobj ( mat , dims = [[ 2 , 2 ], [ 2 , 2 ]]) def user_gate2 (): # T gate mat = np . array ([[ 1. , 0 ], [ 0. , 1. j ]]) return Qobj ( mat , dims = [[ 2 ], [ 2 ]]) To let the QubitCircuit process those gates, one can modify its the attribut...