Exemplo n.º 1
0
taus = []
Gs = []
Gerrs = []
for line in fileinput.input(unk):
    words = line.split(' ')
    taus.append(float(words[0]))
    Gs.append(float(words[1]))
    Gerrs.append(float(words[2]))
taus = np.array(taus)
Gs = np.array(Gs)
Gerrs = np.array(Gerrs)
W = np.diag(Gerrs**(-2))

# perform SVD on the kernel
omegas = np.linspace(0, 5, 501)
K = kernels.imagt_kernel(taus, omegas, args.beta)
V, Sigma, U = np.linalg.svd(K)
U = U.T

# print the singular values
for s in Sigma:
    print(s)
print('\n')

# project into singular space
Sigma = np.array(list(itertools.takewhile(lambda x: x > args.cutoff, Sigma)))
s = Sigma.size
V = V[:, :s]
U = U[:, :s]
VSigma = np.dot(V, np.diag(Sigma))
print('Singular space dimension: ',
Exemplo n.º 2
0
taus = []
Gs = []
Gerrs = []
for line in fileinput.input(unk):
    words = line.split(" ")
    taus.append(float(words[0]))
    Gs.append(float(words[1]))
    Gerrs.append(float(words[2]))
taus = np.array(taus)
Gs = np.array(Gs)
Gerrs = np.array(Gerrs)
W = np.diag(Gerrs ** (-2))

# perform SVD on the kernel
omegas = np.linspace(0, 5, 501)
K = kernels.imagt_kernel(taus, omegas, args.beta)
V, Sigma, U = np.linalg.svd(K)
U = U.T

# print the singular values
for s in Sigma:
    print(s)
print("\n")

# project into singular space
Sigma = np.array(list(itertools.takewhile(lambda x: x > args.cutoff, Sigma)))
s = Sigma.size
V = V[:, :s]
U = U[:, :s]
VSigma = np.dot(V, np.diag(Sigma))
print("Singular space dimension: ", s, " (down from ", min(taus.size, omegas.size), ")", sep="", file=sys.stderr)
Exemplo n.º 3
0
    gap = 0.91
    W = 8.4
    N = 1./np.sqrt(W**2/2 - gap**2)
    return np.array([N * o / np.sqrt(o**2 - gap**2) if gap < o <= W/2 else 0.
                     for o in omegas])

parser = argparse.ArgumentParser()
parser.add_argument('--eta', type=float, default=1e-4)
parser.add_argument('--beta', type=float, default=1.)
parser.add_argument('--spectrum', action='store_true')
parser.add_argument('--exact', action='store_true')
parser.add_argument('--bcs', action='store_true')
args = parser.parse_args()

model = bcs if args.bcs else two_peaks

taus = np.linspace(0, args.beta/2, 1001)
omegas = np.linspace(0, 10, 1001)

if args.spectrum:
    for omega, A in izip(omegas, model(omegas)):
        print omega, A
    exit(0)

green = np.dot(kernels.imagt_kernel(taus, omegas, args.beta), model(omegas))
if not args.exact:
    green *= 1 + args.eta * np.random.standard_normal(green.shape)

for tau, G in izip(taus, green):
    print tau, G, args.eta * G if not args.exact else 0