Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 2 additions & 30 deletions src/fle_2d/fle_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,29 +93,12 @@ def precomp(
else:
ne = int(L ** 2 * np.pi / 4)

max_bandlimit = L
psi, ns, ks, lmds, cs, ne = self.lap_eig_disk(
ne, bandlimit, max_bandlimit
)
psi, ns, ks, lmds, cs, ne = self.lap_eig_disk(ne, bandlimit)

nmax = np.max(np.abs(ns))
b_sz = (n_interp, 2 * nmax + 1)
b = np.zeros(b_sz)

ndx = 2 * np.abs(ns) - (ns < 0)
ndmax = np.max(ndx)
idx_list = [None] * (ndmax + 1)
for i in range(ndmax + 1):
idx_list[i] = []
for i in range(ne):
nd = ndx[i]
idx_list[nd].append(i)

nmax = np.max(np.abs(ns))
v = 0
for i in range(len(idx_list)):
v = max(len(idx_list[i]), v)

# Source points
xs = 1 - (2 * np.arange(n_interp) + 1) / (2 * n_interp)
xs = np.cos(np.pi * xs)
Expand All @@ -126,8 +109,6 @@ def precomp(
if ne == 1:
lmd1 = lmd1 * (1 + 2e-16)

a = np.zeros(ne, dtype=np.float64)

# Make a list of lists: idx_list[i] is the index of all values i
ndx = 2 * np.abs(ns) - (ns < 0)
ndmax = np.max(ndx)
Expand All @@ -150,7 +131,6 @@ def precomp(
if numsparse <= 0:
ws = self.get_weights(xs)

a = np.zeros(ne, dtype=np.float64)
A3 = [None] * (ndmax + 1)
A3_T = [None] * (ndmax + 1)
for i in range(ndmax + 1):
Expand All @@ -174,9 +154,7 @@ def precomp(
)
else:
A3[i] = np.zeros((n, mm))
numer = np.zeros(n)
denom = np.zeros(n)
exact = np.zeros(n)
for j in range(mm):
xdiff = x - xs[j]
temp = ws[j] / xdiff
Expand Down Expand Up @@ -336,7 +314,6 @@ def precomp(

def radialconv_wts(self, b):

ne = self.ne
nb = b.shape[0]
b = np.array(b, order="F")
if self.n_interp > self.n_radial:
Expand All @@ -345,14 +322,11 @@ def radialconv_wts(self, b):
b = np.concatenate((b, bz), axis=1)
b = idct(b, axis=1, type=2) * 2 * b.shape[1]

h = self.h

b = np.moveaxis(b, 0, -1)

a = np.zeros((self.ne, nb), dtype=np.float64)


y = [None] * (self.ndmax + 1)
for i in range(self.ndmax + 1):
a[self.idx_list[i]] = (self.A3[i] @ b[:, 0, :])

Expand Down Expand Up @@ -742,7 +716,7 @@ def create_denseB(self, numthread=1):

return B.reshape(self.L1 ** 2, self.ne)

def lap_eig_disk(self, ne, bandlimit, max_bandlimit):
def lap_eig_disk(self, ne, bandlimit):

# number of roots to check
nc = int(3 * np.sqrt(ne))
Expand Down Expand Up @@ -968,8 +942,6 @@ def barycentric_interp_sparse(self, x, xs, ys, s):
jdx = np.zeros((n, s))
vals = np.zeros((n, s))
xss = np.zeros((n, s))
idps = np.zeros((n, s))
numer = np.zeros((n, 1))
denom = np.zeros((n, 1))
temp = np.zeros((n, 1))
ws = np.zeros((n, s))
Expand Down