-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
31 lines (25 loc) · 917 Bytes
/
Copy pathutils.py
File metadata and controls
31 lines (25 loc) · 917 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 8 15:33:28 2019
@author: kin
"""
from qutip import basis, tensor, Qobj
from numpy import dot, empty
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
def get_ion_state_generators(num_focks):
"""
Return a 2-tuple of two functions (ground, excited).
The excited function generates an excited state in the n-th Fock state.
The ground function generates an ground state in the n-th Fock state.
It's cutomary to name the excited and ground functions e and g respectively
in actual use, for instance:
e, g = get_ion_state_generators(5)
To get a |g2> state use g(2)
To get a |e3> state use e(3)
"""
return (lambda n: tensor(basis(2, 1), basis(num_focks, n)),
lambda n: tensor(basis(2, 0), basis(num_focks, n)))
def transform(U, H):
return dot(U, dot(H, U.conj().T))