MCPcopy Create free account
hub / github.com/numpy/numpy / __init__

Method __init__

numpy/lib/polynomial.py:1227–1252  ·  view source on GitHub ↗
(self, c_or_r, r=False, variable=None)

Source from the content-addressed store, hash-verified

1225 o = order
1226
1227 def __init__(self, c_or_r, r=False, variable=None):
1228 if isinstance(c_or_r, poly1d):
1229 self._variable = c_or_r._variable
1230 self._coeffs = c_or_r._coeffs
1231
1232 if set(c_or_r.__dict__) - set(self.__dict__):
1233 msg = ("In the future extra properties will not be copied "
1234 "across when constructing one poly1d from another")
1235 warnings.warn(msg, FutureWarning, stacklevel=2)
1236 self.__dict__.update(c_or_r.__dict__)
1237
1238 if variable is not None:
1239 self._variable = variable
1240 return
1241 if r:
1242 c_or_r = poly(c_or_r)
1243 c_or_r = atleast_1d(c_or_r)
1244 if c_or_r.ndim > 1:
1245 raise ValueError("Polynomial must be 1d only.")
1246 c_or_r = trim_zeros(c_or_r, trim='f')
1247 if len(c_or_r) == 0:
1248 c_or_r = NX.array([0], dtype=c_or_r.dtype)
1249 self._coeffs = c_or_r
1250 if variable is None:
1251 variable = 'x'
1252 self._variable = variable
1253
1254 def __array__(self, t=None):
1255 if t:

Callers

nothing calls this directly

Calls 5

atleast_1dFunction · 0.90
trim_zerosFunction · 0.90
polyFunction · 0.85
warnMethod · 0.80
updateMethod · 0.80

Tested by

no test coverage detected