(self, c_or_r, r=False, variable=None)
| 1248 | o = order |
| 1249 | |
| 1250 | def __init__(self, c_or_r, r=False, variable=None): |
| 1251 | if isinstance(c_or_r, poly1d): |
| 1252 | self._variable = c_or_r._variable |
| 1253 | self._coeffs = c_or_r._coeffs |
| 1254 | |
| 1255 | if set(c_or_r.__dict__) - set(self.__dict__): |
| 1256 | msg = ("In the future extra properties will not be copied " |
| 1257 | "across when constructing one poly1d from another") |
| 1258 | warnings.warn(msg, FutureWarning, stacklevel=2) |
| 1259 | self.__dict__.update(c_or_r.__dict__) |
| 1260 | |
| 1261 | if variable is not None: |
| 1262 | self._variable = variable |
| 1263 | return |
| 1264 | if r: |
| 1265 | c_or_r = poly(c_or_r) |
| 1266 | c_or_r = atleast_1d(c_or_r) |
| 1267 | if c_or_r.ndim > 1: |
| 1268 | raise ValueError("Polynomial must be 1d only.") |
| 1269 | c_or_r = trim_zeros(c_or_r, trim='f') |
| 1270 | if len(c_or_r) == 0: |
| 1271 | c_or_r = NX.array([0], dtype=c_or_r.dtype) |
| 1272 | self._coeffs = c_or_r |
| 1273 | if variable is None: |
| 1274 | variable = 'x' |
| 1275 | self._variable = variable |
| 1276 | |
| 1277 | def __array__(self, t=None, copy=None): |
| 1278 | if t: |
nothing calls this directly
no test coverage detected