From a1f1c6164be57ed8c39b80ff0bb271c9ffcaf036 Mon Sep 17 00:00:00 2001 From: Mark Hale Date: Thu, 11 Jul 2024 22:54:58 +0100 Subject: [PATCH] Automatically set lmin, lmax for RingGraph. --- setup.py | 2 +- sgw_tools/graphs.py | 2 ++ tests/test_biggraph.py | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4d85012..2b3aadc 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name="sgw_tools", - version="2.5.4", + version="2.5.5", author="Mark Hale", license="MIT", description="Spectral graph wavelet tools", diff --git a/sgw_tools/graphs.py b/sgw_tools/graphs.py index 671cd31..1145f50 100644 --- a/sgw_tools/graphs.py +++ b/sgw_tools/graphs.py @@ -30,6 +30,8 @@ def compute_fourier_basis(self, recompute=False, spectrum_only=False): if not N&1: # bipartite self._e[-1] = 2 self._e[0] = 0 + self._lmin = self._e[1] + self._lmax = self._e[-1] if not spectrum_only: # eigenvectors are identical for normalized/adjacency and combinatorial Laplacians diff --git a/tests/test_biggraph.py b/tests/test_biggraph.py index 3ce1838..f025008 100644 --- a/tests/test_biggraph.py +++ b/tests/test_biggraph.py @@ -456,6 +456,7 @@ def _test_ring(self, n=20, lap_type='combinatorial'): expected_evals = scipy.linalg.eigh(graph.L.toarray(), eigvals_only=True) expected_evals[0] = 0 np.testing.assert_allclose(graph.e, expected_evals) + self.assertEqual(graph.lmax, np.max(graph.e)) # check eigenvectors L = graph.L U = graph.U