def __init__(self, n):
self.degree = 2*n - 2
a, A = numpy.polynomial.legendre.leggauss(n)
w = numpy.outer((1 + a) * A, A)
x = numpy.outer(1-a, numpy.ones(n)) / 2
y = numpy.outer(1+a, 1-a) / 4
self.weights = w.reshape(-1) / 4
self.points = numpy.stack([x.reshape(-1), y.reshape(-1)]).T
self.bary = numpy.array([
self.points[:, 0],
self.points[:, 1],
1 - numpy.sum(self.points, axis=1)
]).T
return
评论列表
文章目录