# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .jl
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Julia 1.6.0
#     language: julia
#     name: julia-1.6
# ---

# +
using PyCall

const irbasis = pyimport("irbasis");
# -

# Load basis data for fermions and Lambda = 1000.0
basis = irbasis.load("F", 1000.0)

# l=0, x = 0.1
basis.ulx(0, 0.1)

# Compute u_l(x) for all l's at 10 x points.
# This can be done by using numpy broadcasting.
function compute_ulx_all_l(basis, xs)
    dim = convert(Int64, basis.dim())
    nx = length(xs)
    all_l = collect(0:dim-1) # make sure l starts with 0.
    basis.ulx(reshape(all_l, dim, 1), reshape(xs, 1, nx))
end
nx = 10
xs = LinRange(-1, 1, nx)
ulx_mat = compute_ulx_all_l(basis, xs)
size(ulx_mat)

# Compute unl for n=0, ...., 100
unl = basis.compute_unl(collect(0:100))
size(unl)

# Sampling points in x space
sp_x = basis.sampling_points_x(basis.dim()-1)

# Dimensionless version of F matrix for sparse sampling
F = transpose(compute_ulx_all_l(basis, sp_x))

# Sampling points in n
sp_n = basis.sampling_points_matsubara(basis.dim()-1)

# Dimensionless version of hatF matrix for sparse sampling
hatF = basis.compute_unl(sp_n)



StarcoderdataJupyterScriptsDedupFiltered