* Changing chebyshev implementation to remove numpy dependencies
* Update span.py
This commit is contained in:
Dario Coscia
2022-10-13 16:04:01 +02:00
committed by GitHub
parent 06932196a8
commit 28421049b2
2 changed files with 13 additions and 13 deletions

View File

@@ -1,7 +1,9 @@
import numpy as np
import torch
def chebyshev_roots(n):
""" Return the roots of *n* Chebyshev polynomials (between [-1, 1]) """
coefficents = np.zeros(n+1)
coefficents[-1] = 1
return np.polynomial.chebyshev.chebroots(coefficents)
pi = torch.acos(torch.zeros(1)).item() * 2
k = torch.arange(n)
nodes = torch.sort(torch.cos(pi * (k + 0.5) / n))[0]
return nodes