Пример #1
0
 def setUp(self):
     self.hf = np.zeros([5, 10, 10])
     self.dhf = np.zeros([3, 10, 10])
     self.omega = 3.0
     self.t = 1.0
     self.nz = 9
     self.problem = fs.FixedSystem(self.hf, self.dhf, self.nz, self.omega,
                                   self.t)
Пример #2
0
    def setUp(self):
        g = 0.5
        e1 = 1.2
        e2 = 2.8
        hf = rabi.hf(g, e1, e2)
        dhf = np.array([rabi.hf(1.0, 0, 0)])

        nz = 15
        dim = 2
        omega = 5.0
        t = 20.5
        self.s = fs.FixedSystem(hf, dhf, nz, omega, t)
Пример #3
0
    def _set_cached(self, controls, t):
        self._last_controls = np.copy(controls)
        self._last_t = copy.copy(t)

        hf = self._hf(controls)
        dhf = self._dhf(controls)
        self._fixed_system = fs.FixedSystem(hf,
                                            dhf,
                                            self.nz,
                                            self.omega,
                                            t,
                                            decimals=self.decimals,
                                            sparse=self.sparse,
                                            max_nz=self.max_nz)
Пример #4
0
    def setUp(self):
        g = 0.5
        e1 = 1.2
        e2 = 2.8
        hf = rabi.hf(g, e1, e2)
        dhf = np.array([rabi.hf(1.0, 0, 0)])

        nz = 3
        dim = 2
        omega = 5.0
        t = 1.5
        s = fs.FixedSystem(hf, dhf, nz, omega, t)

        self.ducal = np.array([[-0.43745 + 0.180865j, 0.092544 - 0.0993391j],
                               [-0.0611011 - 0.121241j, -0.36949 - 0.295891j]])
        self.du = s.du
Пример #5
0
    def setUp(self):
        g = 5.0
        e1 = 1.2
        e2 = 2.8
        hf = rabi.hf(g, e1, e2)
        dhf = np.array([rabi.hf(1.0, 0, 0)])

        nz = 3
        dim = 2
        omega = 5.0
        t = 20.5
        self.s = fs.FixedSystem(hf, dhf, nz, omega, t)

        self.u = rabi.u(g, e1, e2, omega, t)
        self.ucal = self.s.u

        self.um = np.matrix(self.ucal)
Пример #6
0
    time = min(timeit.Timer(wrapper(get_u, hf, params)).repeat(5, 20)) / 20
    return " U: " + str(round(time * 1000, 3)) + " ms per execution"


def time_du(func, hf, dhf, params):
    time = min(timeit.Timer(wrapper(func, hf, dhf, params)).repeat(3, 1))
    return "dU: " + str(round(time, 3)) + " s per execution"


ncomp = 6
freq = 1.1
controls = 0.5 * np.ones(2 * ncomp)

hf = spin.hf(ncomp, freq, controls)
dhf = spin.dhf(ncomp)
system = fs.FixedSystem(hf, dhf, 101, 1.0, 1.0)

params = system.params

print "---- Current state"
import floq.core.evolution as ev

print time_u(ev.get_u, hf, params)
print time_du(ev.get_u_and_du, hf, dhf, params)

print "---- With degeneracy check"
import museum_of_evolution.p6.evolution as ev

print time_u(ev.get_u, hf, params)
print time_du(ev.get_u_and_du, hf, dhf, params)
Пример #7
0
 def get_system(self, controls, t):
     hf = self.calculate_hf(controls)
     dhf = self.calculate_dhf(controls)
     return fs.FixedSystem(hf, dhf, self.nz, self.omega, t)