You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/11/14 02:23:28 UTC
[GitHub] [incubator-mxnet] haojin2 commented on a change in pull request
#16788: [Numpy][TVM]Add numpy operator 'polyval' based on tvm
haojin2 commented on a change in pull request #16788: [Numpy][TVM]Add numpy operator 'polyval' based on tvm
URL: https://github.com/apache/incubator-mxnet/pull/16788#discussion_r346099563
##########
File path: python/mxnet/ndarray/numpy/_op.py
##########
@@ -5308,3 +5308,60 @@ def nan_to_num(x, copy=True, nan=0.0, posinf=None, neginf=None, **kwargs):
return _npi.nan_to_num(x, copy=copy, nan=nan, posinf=posinf, neginf=neginf, out=None)
else:
raise TypeError('type {} not supported'.format(str(type(x))))
+
+
+def polyval(p, x):
+ """
+ Evaluate a polynomial at specific values.
+
+ If p is of length N, this function returns the value:
+
+ p[0]*x**(N-1) + p[1]*x**(N-2) + ... + p[N-2]*x + p[N-1]
+ If x is a sequence, then p(x) is returned for each element of x.
+ If x is another polynomial then the composite polynomial p(x(t)) is returned.
+
+ Parameters
+ ----------
+ p : ndarray
+ 1D array of polynomial coefficients (including coefficients equal to zero)
+ from highest degree to the constant term.
+ x : ndarray
+ An array of numbers, at which to evaluate p.
+
+ Returns
+ -------
+ values : ndarray
+ Result array of polynomials
+
+ Notes
+ -----
+ Horner’s scheme is used to evaluate the polynomial.
+ Even so, for polynomials of high degree the values may be
Review comment:
Seems like there's a non-ascii code character on this line.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services