Class NDPolyBase
- Namespace
- NumSharp
- Assembly
- NumSharp.dll
NumPy's numpy.polynomial._polybase.ABCPolyBase: a polynomial series in one of the six bases — power,
Chebyshev, Legendre, Laguerre, Hermite (physicists') and HermiteE (probabilists') — with a domain mapped onto a
window, and the arithmetic, calculus, evaluation, conversion and printing NumPy's series classes have. The
concrete classes are NDPolynomial, NDChebyshev, NDLegendre,
NDLaguerre, NDHermite and NDHermiteE.
public abstract class NDPolyBase : IDisposable, IFormattable
- Inheritance
-
NDPolyBase
- Implements
- Derived
- Inherited Members
Remarks
What the domain and window do. A series is evaluated at off + scl*x, the linear map sending the
domain onto the window (mapparms()): fitting on [0, 100] with a window of [-1, 1] keeps the
basis well conditioned. Arithmetic between two series needs the same class, domain, window and symbol
(NumPy's TypeError: Domains differ and siblings).
Ownership. A series owns its coefficient, domain and window arrays and releases them in
Dispose(); until then a getter hands out the stored array itself. Dispose every series, the results
of operators included (using var r = p * q;): an undisposed one keeps its buffers until the garbage
collector runs. No NDScope reclaims a series (it is not an array).
C# spelling of NumPy's protocol. Every member NumPy names keeps NumPy's name, case included.
p(x) is __call__(object); p ** n, p // q and divmod(p, q) are the
concrete classes' __pow__, __floordiv__ and __divmod__ (C# has no such operators);
+ - * / %, unary - / + and == != are operators. NumPy's class attributes
(Polynomial.domain, window, maxpower, basis_name) are members of the class object
NDPolyClass, reached as NDPolynomial.Class or __class__: C# cannot declare a
static NDPolynomial.domain beside the instance p.domain. The C# protocol members
(Dispose(), Equals(object), GetHashCode(), ToString(),
GetEnumerator(), the concrete classes' Deconstruct) stand in for Python's.
Not hashable. NumPy sets __hash__ = None: GetHashCode() raises NumPy's
TypeError: unhashable type, so a series cannot be a dictionary key — its value can change in place.
Properties
__class__
Python's p.class (type(p)): the series' class object — the same object as the class's
static Class (ReferenceEquals(p.class, NDChebyshev.Class) is NumPy's
p.class is Chebyshev). Its members are NumPy's class attributes, so p.class.domain is
the class default whatever domain the series itself holds; it also converts to the C# type where NumSharp
takes a class (q.convert(kind: p.class)).
public NDPolyClass __class__ { get; }
Property Value
Remarks
Footgun: assigning through it (p.class.maxpower = 5) changes the class, so every series of the
class without its own value, as in Python — use maxpower to change one series.
basis_name
The basis letter the default printers write (NumPy's class attribute basis_name, read through the
series as in Python): null for the power series, T, P, L, H or He
otherwise.
public string basis_name { get; }
Property Value
coef
The series coefficients, low degree first (NumPy's coef): the array this series owns, the same object on
every read. Assigning stores a VIEW of the given array (no check, no copy, as NumPy stores the object):
writes through either reach both. The replaced array is released by the assignment (see
ReleaseReplaced(NDArray, NDArray)): copy one read earlier to keep it; assigning the current array back changes
nothing.
public NDArray coef { get; set; }
Property Value
Exceptions
- ArgumentNullException
Assigning null (NumPy would store None; every later member then fails).
- ObjectDisposedException
The series was disposed.
- AttributeError
Reading a state set by __setstate__(IDictionary) without
coef.
domain
The domain (NumPy's domain): the instance's own array, or the CLASS attribute (Class.domain of
the series' class, read at every access and shared by every instance created without a domain — writing into
it changes the class's, as in NumPy). Assigning stores a view of the given array on this instance and releases
the instance's previous one (never the class attribute; see ReleaseReplaced(NDArray, NDArray)).
public NDArray domain { get; set; }
Property Value
Exceptions
- ArgumentNullException
Assigning null.
- ObjectDisposedException
The series was disposed.
maxpower
The largest power pow allows (NumPy's maxpower): the class attribute (Class.maxpower,
100 unless the class's was assigned) unless assigned on this instance; null is NumPy's None (no limit). Any
value Python can compare with an int works — NumPy's power > maxpower decides (a float 2.5 allows 2).
Assigning here changes this series only.
public object maxpower { get; set; }
Property Value
symbol
The symbol the printers write for the variable (NumPy's read-only symbol, default "x").
public string symbol { get; }
Property Value
Exceptions
- AttributeError
A state set by __setstate__(IDictionary) without
_symbol: NumPy's'Polynomial' object has no attribute '_symbol'.
window
The window (NumPy's window): the instance's own array, or the class attribute (Class.window, read
at every access). Assigning stores a view of the given array on this instance and releases the instance's
previous one (never the class attribute; see ReleaseReplaced(NDArray, NDArray)).
public NDArray window { get; set; }
Property Value
Exceptions
- ArgumentNullException
Assigning null.
- ObjectDisposedException
The series was disposed.
Methods
Dispose()
Releases the arrays this series owns: the coefficients, an instance domain / window, and the statistics of a
full=True fit. Idempotent. A class default is never released (the class owns it). After disposal every
member but Dispose() raises ObjectDisposedException, and an array obtained from a getter
earlier is released too — copy it first to keep it.
public void Dispose()
Equals(object)
NumPy's eq: isinstance(other, self.class), then (short-circuiting, in this order)
np.all of the domains' and the windows' elementwise equality, equal coefficient shapes,
np.all(self.coef == other.coef), and equal symbols. A float32 series equals a float64 one with the same
values; a NaN coefficient never equals.
public override bool Equals(object obj)
Parameters
objobjectAnything (a value that is not a series of this class is unequal).
Returns
- bool
Whether the two series are NumPy-equal.
Exceptions
- IncorrectShapeException
Domains or windows whose shapes do not broadcast (assigned ones), as NumPy's
==raises.- AttributeError
A state without
coef/_symbol(see __setstate__(IDictionary)), when the comparison reaches it.
GetEnumerator()
The foreach pattern over the coefficients (__iter__()). Deliberately not
IEnumerable: NumPy's array coercion never iterates a series (it has no getitem), and an
IEnumerable series would be read as a Python list by every NumSharp function taking one.
public IEnumerator GetEnumerator()
Returns
- IEnumerator
The enumerator.
Exceptions
- TypeError
A 0-d coefficient array.
GetHashCode()
NumPy's hash = None: a series is not hashable — its coefficients can change in place, so a hash of
them would break any dictionary holding it.
public override int GetHashCode()
Returns
- int
Never returns.
Exceptions
- TypeError
unhashable type: 'Polynomial'(the class's NumPy name), always.
ToString()
NumPy's str(p) (see __str__()).
public override string ToString()
Returns
- string
The text.
ToString(string, IFormatProvider)
C#'s formatting ($"{p:unicode}", string.Format("{0:ascii}", p)): NumPy's format; a null
format is ''.
public string ToString(string format, IFormatProvider formatProvider)
Parameters
formatstringThe format (see __format__(string)).
formatProviderIFormatProviderIgnored: NumPy's printers do not localize.
Returns
- string
The text.
Exceptions
- ValueError
An unsupported format.
__call__(object)
NumPy's p(x) (call): arg = pu.mapdomain(x, self.domain, self.window), then
{p}val(arg, self.coef). A scalar point maps to a NumPy SCALAR (off + scl*x), at which NumPy's
recurrence runs in scalarmath; an array of points is evaluated by the evaluation kernel.
public NDArray __call__(object arg)
Parameters
argobjectThe point(s): a number (a C# number is a Python scalar; a bool becomes a 0-d bool array, as NumPy's mapdomain converts it), an array, or a Python list / tuple. A series argument binds __call__<TSeries>(TSeries).
Returns
- NDArray
The values: an array for array points, a 0-d array (NumPy's scalar) for a scalar point.
Exceptions
- ArgumentException
A series passed through an
objectreference (its result is a series: call __call__<TSeries>(TSeries) with the series typed as its class).- TypeError
None or another object NumPy's object loop refuses (
unsupported operand type(s) for *: 'float' and 'NoneType'); a str (the multiply ufunc's no-loop error).- ValueError
A ragged list.
__call__<TSeries>(TSeries)
NumPy's p(series): the series evaluated AT another series — pu.mapdomain runs NumPy's object loop
(scl's Python value times the series, then the NumPy-scalar offset plus it) and {p}val runs its
recurrence with series values through the class operators (see NDPolyBase.Algebra.cs). This is how
convert and cast change basis.
public TSeries __call__<TSeries>(TSeries arg) where TSeries : NDPolyBase
Parameters
argTSeriesThe series to evaluate at.
Returns
- TSeries
A new series of
TSeries's class, inarg's domain and window.
Type Parameters
TSeriesThe argument's class; the result is of that class.
Exceptions
- ArgumentNullException
argis null.- TypeError
Domains differ/Windows differwhen the recurrence combines two series whose domain or window holds a NaN (NumPy's equality check of the domains fails).
__divmod__(object)
NumPy's divmod(p, other) (divmod): the quotient and the remainder.
public (NDPolyBase quo, NDPolyBase rem) __divmod__(object other)
Parameters
otherobjectThe divisor.
Returns
- (NDPolyBase quo, NDPolyBase rem)
(quo, rem), two new series of this class.
Exceptions
- TypeError
See NumSharp.NDPolyBase.PyBinary(NumSharp.PyBinOp, in NumSharp.PyOperand, in NumSharp.PyOperand).
- ZeroDivisionError
A zero divisor.
__eq__(object)
NumPy's p.eq(other), the method behind ==: Equals(object). Spelled out for code
that calls the protocol method by name; p == other is the same comparison.
public bool __eq__(object other)
Parameters
otherobjectAnything.
Returns
- bool
Whether the two are NumPy-equal (NumPy answers
np.False_when a domain, window or coefficient comparison decides, a Python bool otherwise; both are this bool).
Exceptions
__floordiv__(object)
NumPy's p // other (floordiv, then CPython's fallbacks): the quotient of
divmod(p, other).
public virtual NDPolyBase __floordiv__(object other)
Parameters
otherobjectThe divisor: a series of this class, a number, an array or a sequence of coefficients.
Returns
- NDPolyBase
The quotient series.
Exceptions
- TypeError
See NumSharp.NDPolyBase.PyBinary(NumSharp.PyBinOp, in NumSharp.PyOperand, in NumSharp.PyOperand).
- ZeroDivisionError
A zero divisor.
__format__(string)
NumPy's format(p, fmt) (format): '' is __str__(), 'ascii' and
'unicode' force a printer.
public string __format__(string fmt_str)
Parameters
fmt_strstringThe format:
"","ascii"or"unicode".
Returns
- string
The text.
Exceptions
- ValueError
Any other format:
Unsupported format string 'x' passed to <class 'numpy.polynomial.polynomial.Polynomial'>.format. Valid options are 'ascii' and 'unicode'.
__getstate__()
NumPy's getstate() (what pickle and copy.deepcopy save): self.dict.copy() with
coef, domain and window replaced by COPIES (the class defaults included) and symbol
added — in NumPy's key order (the instance attributes in their assignment order, then whichever of
domain / window was not an instance attribute, then symbol).
public OrderedDictionary __getstate__()
Returns
- OrderedDictionary
A new insertion-ordered dictionary:
coef,domain,windowas new arrays the CALLER owns,_symbolandsymbolas strings,maxpowerwhen assigned on the instance, and any entry an earlier __setstate__(IDictionary) brought (the same objects: NumPy's copy is shallow).
Exceptions
- ObjectDisposedException
The series was disposed.
- AttributeError
A state without
coefor_symbol(NumPy readsself.coefandself.symbol).
__iter__()
NumPy's iter(p): iter(self.coef) — the coefficients (boxed scalars of their dtype; rows of an
assigned N-D array).
public IEnumerator __iter__()
Returns
- IEnumerator
The enumerator.
Exceptions
- TypeError
A 0-d coefficient array:
iteration over a 0-d array.
__len__()
NumPy's len(p): len(self.coef), the number of coefficients (one more than the degree).
public long __len__()
Returns
- long
The length.
Exceptions
- TypeError
A 0-d coefficient array (assigned):
len() of unsized object.
__ne__(object)
NumPy's p.ne(other): not self.eq(other).
public bool __ne__(object other)
Parameters
otherobjectAnything.
Returns
- bool
Whether the two are not NumPy-equal.
Exceptions
__pow__(object)
NumPy's p ** n (pow): self._pow(self.coef, n, maxpower=self.maxpower) — no
try/except, so every error of the power argument propagates — in a new series.
public virtual NDPolyBase __pow__(object power)
Parameters
powerobjectThe power: a non-negative integer (Python's
int(pow)andpower != powdecide: 2.0 and True work, 2.5 and '2' do not).
Returns
- NDPolyBase
The new series.
Exceptions
- ValueError
Power must be a non-negative integer.,Power is too large(above maxpower), int()'s ValueErrors.- TypeError
int() refuses the power:
int() argument must be a string, a bytes-like object or a real number, not 'complex'(a series: its class name),only 0-dimensional arrays can be converted to Python scalars.- OverflowError
An infinite power.
__rdivmod__(object)
NumPy's divmod(other, p) (rdivmod).
public (NDPolyBase quo, NDPolyBase rem) __rdivmod__(object other)
Parameters
otherobjectThe dividend.
Returns
- (NDPolyBase quo, NDPolyBase rem)
(quo, rem), two new series of this class.
Exceptions
- TypeError
See NumSharp.NDPolyBase.PyBinary(NumSharp.PyBinOp, in NumSharp.PyOperand, in NumSharp.PyOperand).
- ZeroDivisionError
This series is zero.
__repr__()
NumPy's repr(p) (repr): Polynomial([1., 2., 3.], domain=[-1., 1.], window=[-1., 1.],
symbol='x') — each array's repr with array( and ) cut off, so a dtype and NumPy's line wrapping
and summarization come through as the array printer makes them.
public string __repr__()
Returns
- string
The text.
__rfloordiv__(object)
NumPy's other // p (rfloordiv): the quotient of divmod(other, p).
public virtual NDPolyBase __rfloordiv__(object other)
Parameters
otherobjectThe dividend.
Returns
- NDPolyBase
The quotient series.
Exceptions
- TypeError
See NumSharp.NDPolyBase.PyBinary(NumSharp.PyBinOp, in NumSharp.PyOperand, in NumSharp.PyOperand).
- ZeroDivisionError
This series is zero.
__setstate__(IDictionary)
NumPy's setstate(dict) (self.dict = dict, what pickle restores): this series' state
becomes exactly the entries of state — coef, domain, window,
_symbol, maxpower — and an attribute the dictionary lacks is gone: no coef or
_symbol makes the members that read it raise NumPy's AttributeError; no domain / window /
maxpower falls back to the class attribute.
public void __setstate__(IDictionary state)
Parameters
stateIDictionaryThe state: __getstate__()'s dictionary, or any dictionary with string keys. The arrays are stored as VIEWS (as the property setters store them: writes through either reach both); entries this series does not model (NumPy keeps any attribute) are kept and returned by __getstate__().
Remarks
The arrays the series held before are released, as an assignment releases them (ReleaseReplaced(NDArray, NDArray)), except one the state hands back itself, which is kept as it is.
Exceptions
- ArgumentNullException
stateis null.- ObjectDisposedException
The series was disposed.
- TypeError
A key that is not a string, a
coef/domain/windowthat is not an NDArray, or a_symbolthat is not a string. NumPy stores any of these as they are (and fails later, in the member that reads them); NumSharp's series holds them typed, so it refuses a value it cannot hold up front — a documented divergence.
__str__()
NumPy's str(p) (str): the series written out with the current print style — the ASCII printer
(1.0 + 2.0 x + 3.0 x**2) on Windows unless np.polynomial.set_default_printstyle("unicode") was
called, the Unicode one (1.0 + 2.0·x + 3.0·x²) elsewhere.
public string __str__()
Returns
- string
The text.
Exceptions
- ValueError
An assigned N-D coefficient array (NumPy's truth-value error of
coef >= 0).
_repr_latex_()
NumPy's repr_latex(): \(x \mapsto \text{1.0} + \text{2.0}\,x\) — each coefficient a LaTeX
\text{} scalar, a non-real one in parentheses, a zero term greyed out with
\color{LightGray}{...}.
public string _repr_latex_()
Returns
- string
The LaTeX text.
Exceptions
- ValueError
An assigned N-D coefficient array (NumPy's truth-value error).
convert(object, Type, object)
NumPy's convert(domain=None, kind=None, window=None): this series as a series of class
kind on domain / window — self(kind.identity(domain,
window=window, symbol=self.symbol)), NumPy's recurrence run at the target class's identity series.
public NDPolyBase convert(object domain = null, Type kind = null, object window = null)
Parameters
domainobjectThe target domain: null for
kind's class attributedomain.kindTypeThe target class:
typeof(NDChebyshev), or its class object (NDChebyshev.Class,q.class), which converts to the type; null for this series' class.windowobjectThe target window: null for
kind's class attributewindow.
Returns
- NDPolyBase
A new series of
kind.
Remarks
Conversion between bases can be numerically ill conditioned (NumPy's note): a high-degree series in a wide domain loses digits.
Exceptions
- AttributeError
kindis not one of the six series classes.- ValueError
A target domain / window the constructor refuses.
- TypeError
Domains differ/Windows differ: a target domain or window holding a NaN.
copy()
NumPy's copy(): self.class(self.coef, self.domain, self.window, self.symbol) — a new series
with copies of the coefficients, the domain and the window (a class default is copied too: the copy owns its
own).
public virtual NDPolyBase copy()
Returns
- NDPolyBase
The copy.
Exceptions
- ValueError
An assigned domain or window of the wrong length (the constructor's check).
cutdeg(object)
NumPy's cutdeg(deg): self.truncate(deg + 1) — the series cut to degree deg,
with Python's + on whatever deg is (a float 1.0 works, 1.5 fails truncate's integer
check, a str fails the +).
public virtual NDPolyBase cutdeg(object deg)
Parameters
degobjectThe degree: a non-negative integer (anything whose
+ 1truncate accepts).
Returns
- NDPolyBase
The new series.
Exceptions
- ValueError
size must be a positive integer.- TypeError
Python's
+refusesdeg(can only concatenate str (not "int") to str,unsupported operand type(s) for +: 'NoneType' and 'int'), orint()refuses the sum (an array of one or more dims).
degree()
NumPy's degree(): len(self) - 1. Trailing zero coefficients count (see trim(object)).
public long degree()
Returns
- long
The degree.
Exceptions
- TypeError
A 0-d coefficient array.
deriv(int)
NumPy's deriv(m=1): {p}der(self.coef, m, scl) in a new series, with the map's scale as the chain
rule's factor (the derivative is taken in the window variable).
public virtual NDPolyBase deriv(int m = 1)
Parameters
mintThe order (≥ 0).
Returns
- NDPolyBase
The new series (the same domain and window).
Exceptions
- ValueError
The order of derivation must be non-negative.
has_samecoef(NDPolyBase)
NumPy's has_samecoef: len(self.coef) == len(other.coef) and np.all(self.coef == other.coef) —
equal lengths, then elementwise == (a NaN coefficient is never the same; -0.0 equals 0.0;
a float32 series compares with a float64 one by value).
public bool has_samecoef(NDPolyBase other)
Parameters
otherNDPolyBaseThe other series.
Returns
- bool
Whether the coefficients match.
Exceptions
- AttributeError
otheris null ('NoneType' object has no attribute 'coef').- ObjectDisposedException
A series was disposed.
has_samedomain(NDPolyBase)
NumPy's has_samedomain: np.all(self.domain == other.domain).
public bool has_samedomain(NDPolyBase other)
Parameters
otherNDPolyBaseThe other series.
Returns
- bool
Whether the domains match elementwise.
Exceptions
- AttributeError
otheris null.- IncorrectShapeException
Domains whose shapes do not broadcast (an assigned domain).
has_sametype(object)
NumPy's has_sametype: isinstance(other, self.class) — any value; a series of another
class, a number or null is not.
public bool has_sametype(object other)
Parameters
otherobjectThe value.
Returns
- bool
Whether
otheris a series of this class.
has_samewindow(NDPolyBase)
NumPy's has_samewindow: np.all(self.window == other.window).
public bool has_samewindow(NDPolyBase other)
Parameters
otherNDPolyBaseThe other series.
Returns
- bool
Whether the windows match elementwise.
Exceptions
- AttributeError
otheris null.- IncorrectShapeException
Windows whose shapes do not broadcast (an assigned window).
integ(int, object, object)
NumPy's integ(m=1, k=[], lbnd=None): the definite integral in a new series. NumPy integrates in the
WINDOW variable, so the lower bound is mapped there (lbnd = off + scl*lbnd, a NumPy scalar; 0 for None)
and every order is scaled by 1./scl — then {p}int(self.coef, m, k, lbnd, 1./scl).
public virtual NDPolyBase integ(int m = 1, object k = null, object lbnd = null)
Parameters
mintThe number of integrations (≥ 0).
kobjectThe integration constants (null for NumPy's
[]): a scalar or a sequence, at mostmof them, missing ones 0.lbndobjectThe lower bound in the DOMAIN variable: null for NumPy's None (the window's 0), or a scalar.
Returns
- NDPolyBase
The new series (the same domain and window).
Exceptions
- ValueError
The order of integration must be non-negative,Too many integration constants,lbnd must be a scalar.(an array bound).- TypeError
A sequence or str bound:
can't multiply sequence by non-int of type 'numpy.float64'(the scale's NumPy type); another object NumPy's object loop refuses.
linspace(long, object)
NumPy's linspace(n=100, domain=None): x = np.linspace(domain[0], domain[1], n) and
y = self(x) — the series sampled at n equally spaced points of the domain (a plotting
aid).
public (NDArray x, NDArray y) linspace(long n = 100, object domain = null)
Parameters
nlongThe number of points (≥ 0).
domainobjectThe interval: null for the series' domain, or anything indexable at 0 and 1.
Returns
- (NDArray Lhs, NDArray Rhs)
(x, y): x in the endpoints' type (float64 for Python numbers and float64 domains, float32 for a float32 domain, complex128 for a complex one), y the values.
Exceptions
- ValueError
Number of samples, -1, must be non-negative.- IndexError
An interval shorter than two.
mapparms()
NumPy's mapparms(): pu.mapparms(self.domain, self.window) — the offset and scale of the map
off + scl*x sending the domain onto the window (identity when they are equal).
public (object off, object scl) mapparms()
Returns
- (object off, object scl)
(off, scl), each a boxed C# number of the NumPy scalar's dtype (doublefor float64, Complex for complex128,floatfor a float32 domain and window, ...).
roots()
NumPy's roots(): {p}roots(self.coef) — the companion matrix's eigenvalues, in the window
variable — mapped back to the domain (pu.mapdomain(roots, self.window, self.domain)).
public NDArray roots()
Returns
- NDArray
The roots in the domain variable (float64, or complex128 when they are complex).
Exceptions
- MissingBackendException
A series of degree ≥ 2 without a LAPACK backend (the eigenvalues need
NumSharp.Interop.OpenBLAS).
trim(object)
NumPy's trim(tol=0): pu.trimcoef(self.coef, tol) in a new series — the trailing coefficients whose
magnitude is at most tol removed (all of them leaves one zero).
public virtual NDPolyBase trim(object tol)
Parameters
tolobjectThe tolerance: omitted for NumPy's default 0, or a Python / NumPy number (see
np.polynomial.polyutils.trimcoef). An explicit null is NumPy'stol=None, which trimcoef'stol < 0refuses.
Returns
- NDPolyBase
The new series.
Exceptions
- ValueError
tol must be non-negative.- TypeError
A tolerance that does not compare with 0 (complex, str, None).
truncate(object)
NumPy's truncate(size): isize = int(size); isize != size or isize < 1 raises; then the
first isize coefficients (all of them when there are fewer) in a new series.
public virtual NDPolyBase truncate(object size)
Parameters
sizeobjectThe length: a positive integer (Python's
int()and!=decide: 2.0 works, 2.5 and '2' do not).
Returns
- NDPolyBase
The new series.
Exceptions
- ValueError
size must be a positive integer; or int()'s own ValueError (a NaN, an unparsable str — a parsable one fails the!=).- TypeError
int() refuses
size(None, complex, a list, an array of one or more dims).- OverflowError
An infinity.
Operators
operator +(NDArray, NDPolyBase)
NumPy's other + p: the other operand declines, then the series' radd.
public static NDPolyBase operator +(NDArray a, NDPolyBase b)
Parameters
aNDArrayThe other operand.
bNDPolyBaseThe series.
Returns
- NDPolyBase
The sum.
operator +(NDPolyBase, NDArray)
NumPy's p + other (see NumSharp.NDPolyBase.PyBinary(NumSharp.PyBinOp, in NumSharp.PyOperand, in NumSharp.PyOperand)).
public static NDPolyBase operator +(NDPolyBase a, NDArray b)
Parameters
aNDPolyBaseThe series.
bNDArrayA series of the same class, a number, an array or a sequence of coefficients.
Returns
- NDPolyBase
The sum.
operator +(NDPolyBase, Array)
NumPy's p + seq for a C# array (p + new[] { 1.0, 2.0 }, NumPy's p + [1, 2]): an
overload of its own because C# would otherwise convert the array to an NDArray at the call
site and bind operator +(NDPolyBase, NDArray), leaving that temporary to the garbage
collector. The array is read as NumPy reads an ndarray operand.
public static NDPolyBase operator +(NDPolyBase a, Array b)
Parameters
aNDPolyBaseThe series.
bArrayThe coefficients.
Returns
- NDPolyBase
The sum.
operator +(NDPolyBase, object)
NumPy's p + other (see NumSharp.NDPolyBase.PyBinary(NumSharp.PyBinOp, in NumSharp.PyOperand, in NumSharp.PyOperand)).
public static NDPolyBase operator +(NDPolyBase a, object b)
Parameters
aNDPolyBaseThe series.
bobjectA series of the same class, a number, an array or a sequence of coefficients.
Returns
- NDPolyBase
The sum.
operator +(NDPolyBase, object[])
NumPy's p + other (see NumSharp.NDPolyBase.PyBinary(NumSharp.PyBinOp, in NumSharp.PyOperand, in NumSharp.PyOperand)).
public static NDPolyBase operator +(NDPolyBase a, object[] b)
Parameters
aNDPolyBaseThe series.
bobject[]A series of the same class, a number, an array or a sequence of coefficients.
Returns
- NDPolyBase
The sum.
operator +(NDPolyBase, string)
NumPy's p + "text", a TypeError as in NumPy: an overload of its own so the C# string reaches the
protocol as Python's str, not through NumSharp's string-to-char-array conversion (whose temporary would be
left to the garbage collector). Footgun: p + null is ambiguous between this overload and the
object[] one; NumPy's p + None is p + (object)null.
public static NDPolyBase operator +(NDPolyBase a, string b)
Parameters
aNDPolyBaseThe series.
bstringThe text.
Returns
- NDPolyBase
Never: NumPy's TypeError.
operator +(Array, NDPolyBase)
NumPy's other + p: the other operand declines, then the series' radd.
public static NDPolyBase operator +(Array a, NDPolyBase b)
Parameters
aArrayThe other operand.
bNDPolyBaseThe series.
Returns
- NDPolyBase
The sum.
operator +(IList, NDPolyBase)
NumPy's other + p: the other operand declines, then the series' radd.
public static NDPolyBase operator +(IList a, NDPolyBase b)
Parameters
aIListThe other operand.
bNDPolyBaseThe series.
Returns
- NDPolyBase
The sum.
operator +(object[], NDPolyBase)
NumPy's other + p: the other operand declines, then the series' radd.
public static NDPolyBase operator +(object[] a, NDPolyBase b)
Parameters
aobject[]The other operand.
bNDPolyBaseThe series.
Returns
- NDPolyBase
The sum.
operator +(ITuple, NDPolyBase)
NumPy's other + p: the other operand declines, then the series' radd.
public static NDPolyBase operator +(ITuple a, NDPolyBase b)
Parameters
aITupleThe other operand.
bNDPolyBaseThe series.
Returns
- NDPolyBase
The sum.
operator +(string, NDPolyBase)
NumPy's other + p: the other operand declines, then the series' radd.
public static NDPolyBase operator +(string a, NDPolyBase b)
Parameters
astringThe other operand.
bNDPolyBaseThe series.
Returns
- NDPolyBase
The sum.
operator /(NDArray, NDPolyBase)
NumPy's other / p: always CPython's TypeError (rtruediv declines every operand).
public static NDPolyBase operator /(NDArray a, NDPolyBase b)
Parameters
aNDArrayThe other operand.
bNDPolyBaseThe series.
Returns
- NDPolyBase
Never returns.
operator /(NDPolyBase, NDArray)
NumPy's p / other: only a number divides (p // number).
public static NDPolyBase operator /(NDPolyBase a, NDArray b)
Parameters
aNDPolyBaseThe series.
bNDArrayA Python or NumPy number (not a bool).
Returns
- NDPolyBase
The quotient.
operator /(NDPolyBase, Array)
NumPy's p / seq for a C# array (p / new[] { 1.0, 2.0 }, NumPy's p / [1, 2]): an
overload of its own because C# would otherwise convert the array to an NDArray at the call
site and bind operator /(NDPolyBase, NDArray), leaving that temporary to the garbage
collector. The array is read as NumPy reads an ndarray operand.
public static NDPolyBase operator /(NDPolyBase a, Array b)
Parameters
aNDPolyBaseThe series.
bArrayThe coefficients.
Returns
- NDPolyBase
The quotient.
operator /(NDPolyBase, object)
NumPy's p / other: only a number divides (p // number).
public static NDPolyBase operator /(NDPolyBase a, object b)
Parameters
aNDPolyBaseThe series.
bobjectA Python or NumPy number (not a bool).
Returns
- NDPolyBase
The quotient.
operator /(NDPolyBase, object[])
NumPy's p / other: only a number divides (p // number).
public static NDPolyBase operator /(NDPolyBase a, object[] b)
Parameters
aNDPolyBaseThe series.
bobject[]A Python or NumPy number (not a bool).
Returns
- NDPolyBase
The quotient.
operator /(NDPolyBase, string)
NumPy's p / "text", a TypeError as in NumPy: an overload of its own so the C# string reaches the
protocol as Python's str, not through NumSharp's string-to-char-array conversion (whose temporary would be
left to the garbage collector). Footgun: p / null is ambiguous between this overload and the
object[] one; NumPy's p / None is p / (object)null.
public static NDPolyBase operator /(NDPolyBase a, string b)
Parameters
aNDPolyBaseThe series.
bstringThe text.
Returns
- NDPolyBase
Never: NumPy's TypeError.
operator /(Array, NDPolyBase)
NumPy's other / p: always CPython's TypeError (rtruediv declines every operand).
public static NDPolyBase operator /(Array a, NDPolyBase b)
Parameters
aArrayThe other operand.
bNDPolyBaseThe series.
Returns
- NDPolyBase
Never returns.
operator /(IList, NDPolyBase)
NumPy's other / p: always CPython's TypeError (rtruediv declines every operand).
public static NDPolyBase operator /(IList a, NDPolyBase b)
Parameters
aIListThe other operand.
bNDPolyBaseThe series.
Returns
- NDPolyBase
Never returns.
operator /(object[], NDPolyBase)
NumPy's other / p: always CPython's TypeError (rtruediv declines every operand).
public static NDPolyBase operator /(object[] a, NDPolyBase b)
Parameters
aobject[]The other operand.
bNDPolyBaseThe series.
Returns
- NDPolyBase
Never returns.
operator /(ITuple, NDPolyBase)
NumPy's other / p: always CPython's TypeError (rtruediv declines every operand).
public static NDPolyBase operator /(ITuple a, NDPolyBase b)
Parameters
aITupleThe other operand.
bNDPolyBaseThe series.
Returns
- NDPolyBase
Never returns.
operator /(string, NDPolyBase)
NumPy's other / p: always CPython's TypeError (rtruediv declines every operand).
public static NDPolyBase operator /(string a, NDPolyBase b)
Parameters
astringThe other operand.
bNDPolyBaseThe series.
Returns
- NDPolyBase
Never returns.
operator ==(NDPolyBase, NDPolyBase)
NumPy's == (Equals(object)); two nulls are equal, null against a series is not.
public static bool operator ==(NDPolyBase a, NDPolyBase b)
Parameters
aNDPolyBaseOne series.
bNDPolyBaseThe other.
Returns
- bool
Whether they are NumPy-equal.
Exceptions
operator ==(NDPolyBase, object)
NumPy's series == other for a value that is not a series (always false: eq answers
False and the other side's reflected eq is never reached).
public static bool operator ==(NDPolyBase a, object b)
Parameters
aNDPolyBaseThe series.
bobjectAnything.
Returns
- bool
Whether they are NumPy-equal.
operator ==(object, NDPolyBase)
NumPy's other == series: the other side's eq declines, so the series' answers.
public static bool operator ==(object a, NDPolyBase b)
Parameters
aobjectAnything.
bNDPolyBaseThe series.
Returns
- bool
Whether they are NumPy-equal.
operator !=(NDPolyBase, NDPolyBase)
NumPy's !=: not self.eq(other).
public static bool operator !=(NDPolyBase a, NDPolyBase b)
Parameters
aNDPolyBaseOne series.
bNDPolyBaseThe other.
Returns
- bool
Whether they are not NumPy-equal.
Exceptions
operator !=(NDPolyBase, object)
NumPy's series != other.
public static bool operator !=(NDPolyBase a, object b)
Parameters
aNDPolyBaseThe series.
bobjectAnything.
Returns
- bool
Whether they are not NumPy-equal.
operator !=(object, NDPolyBase)
NumPy's other != series.
public static bool operator !=(object a, NDPolyBase b)
Parameters
aobjectAnything.
bNDPolyBaseThe series.
Returns
- bool
Whether they are not NumPy-equal.
operator %(NDArray, NDPolyBase)
NumPy's other % p: the series' rmod (a str's % formats first).
public static NDPolyBase operator %(NDArray a, NDPolyBase b)
Parameters
aNDArrayThe dividend.
bNDPolyBaseThe series.
Returns
- NDPolyBase
The remainder.
operator %(NDPolyBase, NDArray)
NumPy's p % other: the remainder of divmod(p, other).
public static NDPolyBase operator %(NDPolyBase a, NDArray b)
Parameters
aNDPolyBaseThe series.
bNDArrayThe divisor.
Returns
- NDPolyBase
The remainder.
operator %(NDPolyBase, Array)
NumPy's p % seq for a C# array (p % new[] { 1.0, 2.0 }, NumPy's p % [1, 2]): an
overload of its own because C# would otherwise convert the array to an NDArray at the call
site and bind operator %(NDPolyBase, NDArray), leaving that temporary to the garbage
collector. The array is read as NumPy reads an ndarray operand.
public static NDPolyBase operator %(NDPolyBase a, Array b)
Parameters
aNDPolyBaseThe series.
bArrayThe coefficients.
Returns
- NDPolyBase
The remainder.
operator %(NDPolyBase, object)
NumPy's p % other: the remainder of divmod(p, other).
public static NDPolyBase operator %(NDPolyBase a, object b)
Parameters
aNDPolyBaseThe series.
bobjectThe divisor.
Returns
- NDPolyBase
The remainder.
operator %(NDPolyBase, object[])
NumPy's p % other: the remainder of divmod(p, other).
public static NDPolyBase operator %(NDPolyBase a, object[] b)
Parameters
aNDPolyBaseThe series.
bobject[]The divisor.
Returns
- NDPolyBase
The remainder.
operator %(NDPolyBase, string)
NumPy's p % "text", a TypeError as in NumPy: an overload of its own so the C# string reaches the
protocol as Python's str, not through NumSharp's string-to-char-array conversion (whose temporary would be
left to the garbage collector). Footgun: p % null is ambiguous between this overload and the
object[] one; NumPy's p % None is p % (object)null.
public static NDPolyBase operator %(NDPolyBase a, string b)
Parameters
aNDPolyBaseThe series.
bstringThe text.
Returns
- NDPolyBase
Never: NumPy's TypeError.
operator %(Array, NDPolyBase)
NumPy's other % p: the series' rmod (a str's % formats first).
public static NDPolyBase operator %(Array a, NDPolyBase b)
Parameters
aArrayThe dividend.
bNDPolyBaseThe series.
Returns
- NDPolyBase
The remainder.
operator %(IList, NDPolyBase)
NumPy's other % p: the series' rmod (a str's % formats first).
public static NDPolyBase operator %(IList a, NDPolyBase b)
Parameters
aIListThe dividend.
bNDPolyBaseThe series.
Returns
- NDPolyBase
The remainder.
operator %(object[], NDPolyBase)
NumPy's other % p: the series' rmod (a str's % formats first).
public static NDPolyBase operator %(object[] a, NDPolyBase b)
Parameters
aobject[]The dividend.
bNDPolyBaseThe series.
Returns
- NDPolyBase
The remainder.
operator %(ITuple, NDPolyBase)
NumPy's other % p: the series' rmod (a str's % formats first).
public static NDPolyBase operator %(ITuple a, NDPolyBase b)
Parameters
aITupleThe dividend.
bNDPolyBaseThe series.
Returns
- NDPolyBase
The remainder.
operator %(string, NDPolyBase)
NumPy's other % p: the series' rmod (a str's % formats first).
public static NDPolyBase operator %(string a, NDPolyBase b)
Parameters
astringThe dividend.
bNDPolyBaseThe series.
Returns
- NDPolyBase
The remainder.
operator *(NDArray, NDPolyBase)
NumPy's other * p: the series' rmul.
public static NDPolyBase operator *(NDArray a, NDPolyBase b)
Parameters
aNDArrayThe other operand.
bNDPolyBaseThe series.
Returns
- NDPolyBase
The product.
operator *(NDPolyBase, NDArray)
NumPy's p * other (see NumSharp.NDPolyBase.PyBinary(NumSharp.PyBinOp, in NumSharp.PyOperand, in NumSharp.PyOperand)).
public static NDPolyBase operator *(NDPolyBase a, NDArray b)
Parameters
aNDPolyBaseThe series.
bNDArrayA series of the same class, a number, an array or a sequence of coefficients.
Returns
- NDPolyBase
The product.
operator *(NDPolyBase, Array)
NumPy's p * seq for a C# array (p * new[] { 1.0, 2.0 }, NumPy's p * [1, 2]): an
overload of its own because C# would otherwise convert the array to an NDArray at the call
site and bind operator *(NDPolyBase, NDArray), leaving that temporary to the garbage
collector. The array is read as NumPy reads an ndarray operand.
public static NDPolyBase operator *(NDPolyBase a, Array b)
Parameters
aNDPolyBaseThe series.
bArrayThe coefficients.
Returns
- NDPolyBase
The product.
operator *(NDPolyBase, object)
NumPy's p * other (see NumSharp.NDPolyBase.PyBinary(NumSharp.PyBinOp, in NumSharp.PyOperand, in NumSharp.PyOperand)).
public static NDPolyBase operator *(NDPolyBase a, object b)
Parameters
aNDPolyBaseThe series.
bobjectA series of the same class, a number, an array or a sequence of coefficients.
Returns
- NDPolyBase
The product.
operator *(NDPolyBase, object[])
NumPy's p * other (see NumSharp.NDPolyBase.PyBinary(NumSharp.PyBinOp, in NumSharp.PyOperand, in NumSharp.PyOperand)).
public static NDPolyBase operator *(NDPolyBase a, object[] b)
Parameters
aNDPolyBaseThe series.
bobject[]A series of the same class, a number, an array or a sequence of coefficients.
Returns
- NDPolyBase
The product.
operator *(NDPolyBase, string)
NumPy's p * "text", a TypeError as in NumPy: an overload of its own so the C# string reaches the
protocol as Python's str, not through NumSharp's string-to-char-array conversion (whose temporary would be
left to the garbage collector). Footgun: p * null is ambiguous between this overload and the
object[] one; NumPy's p * None is p * (object)null.
public static NDPolyBase operator *(NDPolyBase a, string b)
Parameters
aNDPolyBaseThe series.
bstringThe text.
Returns
- NDPolyBase
Never: NumPy's TypeError.
operator *(Array, NDPolyBase)
NumPy's other * p: the series' rmul.
public static NDPolyBase operator *(Array a, NDPolyBase b)
Parameters
aArrayThe other operand.
bNDPolyBaseThe series.
Returns
- NDPolyBase
The product.
operator *(IList, NDPolyBase)
NumPy's other * p: the series' rmul.
public static NDPolyBase operator *(IList a, NDPolyBase b)
Parameters
aIListThe other operand.
bNDPolyBaseThe series.
Returns
- NDPolyBase
The product.
operator *(object[], NDPolyBase)
NumPy's other * p: the series' rmul.
public static NDPolyBase operator *(object[] a, NDPolyBase b)
Parameters
aobject[]The other operand.
bNDPolyBaseThe series.
Returns
- NDPolyBase
The product.
operator *(ITuple, NDPolyBase)
NumPy's other * p: the series' rmul.
public static NDPolyBase operator *(ITuple a, NDPolyBase b)
Parameters
aITupleThe other operand.
bNDPolyBaseThe series.
Returns
- NDPolyBase
The product.
operator *(string, NDPolyBase)
NumPy's other * p: the series' rmul.
public static NDPolyBase operator *(string a, NDPolyBase b)
Parameters
astringThe other operand.
bNDPolyBaseThe series.
Returns
- NDPolyBase
The product.
operator -(NDArray, NDPolyBase)
NumPy's other - p: the series' rsub.
public static NDPolyBase operator -(NDArray a, NDPolyBase b)
Parameters
aNDArrayThe other operand.
bNDPolyBaseThe series.
Returns
- NDPolyBase
The difference.
operator -(NDPolyBase, NDArray)
NumPy's p - other (see NumSharp.NDPolyBase.PyBinary(NumSharp.PyBinOp, in NumSharp.PyOperand, in NumSharp.PyOperand)).
public static NDPolyBase operator -(NDPolyBase a, NDArray b)
Parameters
aNDPolyBaseThe series.
bNDArrayA series of the same class, a number, an array or a sequence of coefficients.
Returns
- NDPolyBase
The difference.
operator -(NDPolyBase, Array)
NumPy's p - seq for a C# array (p - new[] { 1.0, 2.0 }, NumPy's p - [1, 2]): an
overload of its own because C# would otherwise convert the array to an NDArray at the call
site and bind operator -(NDPolyBase, NDArray), leaving that temporary to the garbage
collector. The array is read as NumPy reads an ndarray operand.
public static NDPolyBase operator -(NDPolyBase a, Array b)
Parameters
aNDPolyBaseThe series.
bArrayThe coefficients.
Returns
- NDPolyBase
The difference.
operator -(NDPolyBase, object)
NumPy's p - other (see NumSharp.NDPolyBase.PyBinary(NumSharp.PyBinOp, in NumSharp.PyOperand, in NumSharp.PyOperand)).
public static NDPolyBase operator -(NDPolyBase a, object b)
Parameters
aNDPolyBaseThe series.
bobjectA series of the same class, a number, an array or a sequence of coefficients.
Returns
- NDPolyBase
The difference.
operator -(NDPolyBase, object[])
NumPy's p - other (see NumSharp.NDPolyBase.PyBinary(NumSharp.PyBinOp, in NumSharp.PyOperand, in NumSharp.PyOperand)).
public static NDPolyBase operator -(NDPolyBase a, object[] b)
Parameters
aNDPolyBaseThe series.
bobject[]A series of the same class, a number, an array or a sequence of coefficients.
Returns
- NDPolyBase
The difference.
operator -(NDPolyBase, string)
NumPy's p - "text", a TypeError as in NumPy: an overload of its own so the C# string reaches the
protocol as Python's str, not through NumSharp's string-to-char-array conversion (whose temporary would be
left to the garbage collector). Footgun: p - null is ambiguous between this overload and the
object[] one; NumPy's p - None is p - (object)null.
public static NDPolyBase operator -(NDPolyBase a, string b)
Parameters
aNDPolyBaseThe series.
bstringThe text.
Returns
- NDPolyBase
Never: NumPy's TypeError.
operator -(Array, NDPolyBase)
NumPy's other - p: the series' rsub.
public static NDPolyBase operator -(Array a, NDPolyBase b)
Parameters
aArrayThe other operand.
bNDPolyBaseThe series.
Returns
- NDPolyBase
The difference.
operator -(IList, NDPolyBase)
NumPy's other - p: the series' rsub.
public static NDPolyBase operator -(IList a, NDPolyBase b)
Parameters
aIListThe other operand.
bNDPolyBaseThe series.
Returns
- NDPolyBase
The difference.
operator -(object[], NDPolyBase)
NumPy's other - p: the series' rsub.
public static NDPolyBase operator -(object[] a, NDPolyBase b)
Parameters
aobject[]The other operand.
bNDPolyBaseThe series.
Returns
- NDPolyBase
The difference.
operator -(ITuple, NDPolyBase)
NumPy's other - p: the series' rsub.
public static NDPolyBase operator -(ITuple a, NDPolyBase b)
Parameters
aITupleThe other operand.
bNDPolyBaseThe series.
Returns
- NDPolyBase
The difference.
operator -(string, NDPolyBase)
NumPy's other - p: the series' rsub.
public static NDPolyBase operator -(string a, NDPolyBase b)
Parameters
astringThe other operand.
bNDPolyBaseThe series.
Returns
- NDPolyBase
The difference.
operator -(NDPolyBase)
NumPy's -p.
public static NDPolyBase operator -(NDPolyBase a)
Parameters
aNDPolyBaseThe series.
Returns
- NDPolyBase
The negated series.
operator +(NDPolyBase)
NumPy's +p: the series itself (pos returns self).
public static NDPolyBase operator +(NDPolyBase a)
Parameters
aNDPolyBaseThe series.
Returns
- NDPolyBase
a.