Skip to content

Commit

Permalink
Rename num_eigenfunctions to num_eigenlevels in MaternKarhunenLoeveKe…
Browse files Browse the repository at this point in the history
…rnel to avoid confusion

Signed-off-by: Viacheslav Borovitskiy <vabor112@users.noreply.github.com>
  • Loading branch information
vabor112 authored Aug 24, 2023
1 parent e5503d2 commit 9ac4faa
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions geometric_kernels/kernels/geometric_kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,23 @@ class MaternKarhunenLoeveKernel(BaseGeometricKernel):
def __init__(
self,
space: DiscreteSpectrumSpace,
num_eigenfunctions: int,
num_eigenlevels: int,
):
r"""
:param space: Space providing the eigenvalues and eigenfunctions of
the Laplace-Beltrami operator.
:param nu: Determines continuity of the Mat\'ern kernel. Typical values
include 1/2 (i.e., the Exponential kernel), 3/2, 5/2 and +\infty
`np.inf` which corresponds to the Squared Exponential kernel.
:param num_eigenfunctions: number of eigenvalues and functions to include
in the summation.
:param num_eigenlevels: determines the number of eigenvalues and
functions to include in the summation but does not have to be
equal to the exact number. For example, thanks to the addition
theorem, for spheres this is the number of unique eigenvalues
to use (which is much less than the number of eigenvalues counted
with multiplicity).
"""
super().__init__(space)
self.num_eigenfunctions = num_eigenfunctions # in code referred to as `M`.
self.num_eigenlevels = num_eigenlevels # in code referred to as `M`.

def init_params_and_state(self):
"""
Expand All @@ -63,8 +67,8 @@ def init_params_and_state(self):
"""
params = dict(lengthscale=np.array(1.0), nu=np.array(np.inf))

eigenvalues_laplacian = self.space.get_eigenvalues(self.num_eigenfunctions)
eigenfunctions = self.space.get_eigenfunctions(self.num_eigenfunctions)
eigenvalues_laplacian = self.space.get_eigenvalues(self.num_eigenlevels)
eigenfunctions = self.space.get_eigenfunctions(self.num_eigenlevels)

state = dict(
eigenvalues_laplacian=eigenvalues_laplacian, eigenfunctions=eigenfunctions
Expand Down Expand Up @@ -94,7 +98,7 @@ def eigenfunctions(self) -> Eigenfunctions:
"""
Eigenfunctions of the kernel, may depend on parameters.
"""
eigenfunctions = self.space.get_eigenfunctions(self.num_eigenfunctions)
eigenfunctions = self.space.get_eigenfunctions(self.num_eigenlevels)
return eigenfunctions

def eigenvalues(self, params, state) -> B.Numeric:
Expand Down

0 comments on commit 9ac4faa

Please sign in to comment.