def cand(divisions, orders): if len(divisions) == 0: assert len(orders) == 1 return Mesh1D((a, b), (order + orders[0],)) elif len(divisions) == 1: assert len(orders) == 2 return Mesh1D((a, _fekete.get_x_phys(divisions[0], a, b), b), (order + orders[0], order + orders[1])) else: raise NotImplementedError()
def cand(divisions, orders): if len(divisions) == 0: assert len(orders) == 1 return Mesh1D((a, b), (order + orders[0], )) elif len(divisions) == 1: assert len(orders) == 2 return Mesh1D((a, _fekete.get_x_phys(divisions[0], a, b), b), (order + orders[0], order + orders[1])) else: raise NotImplementedError()
def get_polynomial(self, x, values, a, b): """ Returns the interpolating polynomial's coeffs. The len(values) specifies the order and we work in the element <a, b> """ # Note: the version in _fekete is 2.6x faster n = len(values) A = empty((n, n), dtype="double") y = empty((n,), dtype="double") assert len(x) == n for i in range(n): for j in range(n): A[i, j] = _fekete.get_x_phys(x[i], a, b)**(n-j-1) y[i] = values[i] a = solve(A, y) return a
def get_polynomial(self, x, values, a, b): """ Returns the interpolating polynomial's coeffs. The len(values) specifies the order and we work in the element <a, b> """ # Note: the version in _fekete is 2.6x faster n = len(values) A = empty((n, n), dtype="double") y = empty((n, ), dtype="double") assert len(x) == n for i in range(n): for j in range(n): A[i, j] = _fekete.get_x_phys(x[i], a, b)**(n - j - 1) y[i] = values[i] a = solve(A, y) return a