From e76805866e3ca389ac933b92a2e83657100b7c4c Mon Sep 17 00:00:00 2001 From: John Loverich Date: Sat, 15 Jun 2024 13:39:57 -0700 Subject: [PATCH] Simplify chebyshevLobatto --- high_order_layers_torch/LagrangePolynomial.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/high_order_layers_torch/LagrangePolynomial.py b/high_order_layers_torch/LagrangePolynomial.py index 5f7c12a..a0d61ea 100644 --- a/high_order_layers_torch/LagrangePolynomial.py +++ b/high_order_layers_torch/LagrangePolynomial.py @@ -20,13 +20,7 @@ def chebyshevLobatto(n: int): if n == 1: return torch.tensor([0.0]) - k = torch.arange(0, n) - - ans = -torch.cos(k * math.pi / (n - 1)) - - ans = torch.where(torch.abs(ans) < 1e-15, 0 * ans, ans) - - return ans + return torch.cos(torch.pi * torch.arange(n) / (n - 1)) class FourierBasis: