Files
PINA/pina/chebyshev.py
Dario Coscia 28421049b2 Span (#24)
* Changing chebyshev implementation to remove numpy dependencies
* Update span.py
2022-10-13 16:04:01 +02:00

10 lines
260 B
Python

import torch
def chebyshev_roots(n):
""" Return the roots of *n* Chebyshev polynomials (between [-1, 1]) """
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