Table of Contents

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

NDPolyClass

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

string

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

NDArray

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

NDArray

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

object

symbol

The symbol the printers write for the variable (NumPy's read-only symbol, default "x").

public string symbol { get; }

Property Value

string

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

NDArray

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

obj object

Anything (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

format string

The format (see __format__(string)).

formatProvider IFormatProvider

Ignored: 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

arg object

The 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 object reference (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

arg TSeries

The series to evaluate at.

Returns

TSeries

A new series of TSeries's class, in arg's domain and window.

Type Parameters

TSeries

The argument's class; the result is of that class.

Exceptions

ArgumentNullException

arg is null.

TypeError

Domains differ / Windows differ when 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

other object

The 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

other object

Anything.

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

IncorrectShapeException

See Equals(object).

AttributeError

See Equals(object).

__floordiv__(object)

NumPy's p // other (floordiv, then CPython's fallbacks): the quotient of divmod(p, other).

public virtual NDPolyBase __floordiv__(object other)

Parameters

other object

The 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_str string

The 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, window as new arrays the CALLER owns, _symbol and symbol as strings, maxpower when 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 coef or _symbol (NumPy reads self.coef and self.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

other object

Anything.

Returns

bool

Whether the two are not NumPy-equal.

Exceptions

IncorrectShapeException

See Equals(object).

AttributeError

See Equals(object).

__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

power object

The power: a non-negative integer (Python's int(pow) and power != pow decide: 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

other object

The 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

other object

The 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

state IDictionary

The 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

state is null.

ObjectDisposedException

The series was disposed.

TypeError

A key that is not a string, a coef / domain / window that is not an NDArray, or a _symbol that 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

domain object

The target domain: null for kind's class attribute domain.

kind Type

The target class: typeof(NDChebyshev), or its class object (NDChebyshev.Class, q.class), which converts to the type; null for this series' class.

window object

The target window: null for kind's class attribute window.

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

kind is 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

deg object

The degree: a non-negative integer (anything whose + 1 truncate accepts).

Returns

NDPolyBase

The new series.

Exceptions

ValueError

size must be a positive integer.

TypeError

Python's + refuses deg (can only concatenate str (not "int") to str, unsupported operand type(s) for +: 'NoneType' and 'int'), or int() 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

m int

The 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

other NDPolyBase

The other series.

Returns

bool

Whether the coefficients match.

Exceptions

AttributeError

other is 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

other NDPolyBase

The other series.

Returns

bool

Whether the domains match elementwise.

Exceptions

AttributeError

other is 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

other object

The value.

Returns

bool

Whether other is 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

other NDPolyBase

The other series.

Returns

bool

Whether the windows match elementwise.

Exceptions

AttributeError

other is 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

m int

The number of integrations (≥ 0).

k object

The integration constants (null for NumPy's []): a scalar or a sequence, at most m of them, missing ones 0.

lbnd object

The 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

n long

The number of points (≥ 0).

domain object

The 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 (double for float64, Complex for complex128, float for 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

tol object

The tolerance: omitted for NumPy's default 0, or a Python / NumPy number (see np.polynomial.polyutils.trimcoef). An explicit null is NumPy's tol=None, which trimcoef's tol < 0 refuses.

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

size object

The 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

a NDArray

The other operand.

b NDPolyBase

The 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

a NDPolyBase

The series.

b NDArray

A 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

a NDPolyBase

The series.

b Array

The 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

a NDPolyBase

The series.

b object

A 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

a NDPolyBase

The series.

b object[]

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

a NDPolyBase

The series.

b string

The 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

a Array

The other operand.

b NDPolyBase

The 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

a IList

The other operand.

b NDPolyBase

The 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

a object[]

The other operand.

b NDPolyBase

The 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

a ITuple

The other operand.

b NDPolyBase

The 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

a string

The other operand.

b NDPolyBase

The 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

a NDArray

The other operand.

b NDPolyBase

The 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

a NDPolyBase

The series.

b NDArray

A 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

a NDPolyBase

The series.

b Array

The 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

a NDPolyBase

The series.

b object

A 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

a NDPolyBase

The series.

b object[]

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

a NDPolyBase

The series.

b string

The 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

a Array

The other operand.

b NDPolyBase

The 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

a IList

The other operand.

b NDPolyBase

The 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

a object[]

The other operand.

b NDPolyBase

The 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

a ITuple

The other operand.

b NDPolyBase

The 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

a string

The other operand.

b NDPolyBase

The 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

a NDPolyBase

One series.

b NDPolyBase

The other.

Returns

bool

Whether they are NumPy-equal.

Exceptions

IncorrectShapeException

See Equals(object).

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

a NDPolyBase

The series.

b object

Anything.

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

a object

Anything.

b NDPolyBase

The 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

a NDPolyBase

One series.

b NDPolyBase

The other.

Returns

bool

Whether they are not NumPy-equal.

Exceptions

IncorrectShapeException

See Equals(object).

operator !=(NDPolyBase, object)

NumPy's series != other.

public static bool operator !=(NDPolyBase a, object b)

Parameters

a NDPolyBase

The series.

b object

Anything.

Returns

bool

Whether they are not NumPy-equal.

operator !=(object, NDPolyBase)

NumPy's other != series.

public static bool operator !=(object a, NDPolyBase b)

Parameters

a object

Anything.

b NDPolyBase

The 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

a NDArray

The dividend.

b NDPolyBase

The 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

a NDPolyBase

The series.

b NDArray

The 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

a NDPolyBase

The series.

b Array

The 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

a NDPolyBase

The series.

b object

The 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

a NDPolyBase

The series.

b object[]

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

a NDPolyBase

The series.

b string

The 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

a Array

The dividend.

b NDPolyBase

The 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

a IList

The dividend.

b NDPolyBase

The 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

a object[]

The dividend.

b NDPolyBase

The 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

a ITuple

The dividend.

b NDPolyBase

The 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

a string

The dividend.

b NDPolyBase

The series.

Returns

NDPolyBase

The remainder.

operator *(NDArray, NDPolyBase)

NumPy's other * p: the series' rmul.

public static NDPolyBase operator *(NDArray a, NDPolyBase b)

Parameters

a NDArray

The other operand.

b NDPolyBase

The 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

a NDPolyBase

The series.

b NDArray

A 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

a NDPolyBase

The series.

b Array

The 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

a NDPolyBase

The series.

b object

A 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

a NDPolyBase

The series.

b object[]

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

a NDPolyBase

The series.

b string

The 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

a Array

The other operand.

b NDPolyBase

The series.

Returns

NDPolyBase

The product.

operator *(IList, NDPolyBase)

NumPy's other * p: the series' rmul.

public static NDPolyBase operator *(IList a, NDPolyBase b)

Parameters

a IList

The other operand.

b NDPolyBase

The series.

Returns

NDPolyBase

The product.

operator *(object[], NDPolyBase)

NumPy's other * p: the series' rmul.

public static NDPolyBase operator *(object[] a, NDPolyBase b)

Parameters

a object[]

The other operand.

b NDPolyBase

The series.

Returns

NDPolyBase

The product.

operator *(ITuple, NDPolyBase)

NumPy's other * p: the series' rmul.

public static NDPolyBase operator *(ITuple a, NDPolyBase b)

Parameters

a ITuple

The other operand.

b NDPolyBase

The series.

Returns

NDPolyBase

The product.

operator *(string, NDPolyBase)

NumPy's other * p: the series' rmul.

public static NDPolyBase operator *(string a, NDPolyBase b)

Parameters

a string

The other operand.

b NDPolyBase

The series.

Returns

NDPolyBase

The product.

operator -(NDArray, NDPolyBase)

NumPy's other - p: the series' rsub.

public static NDPolyBase operator -(NDArray a, NDPolyBase b)

Parameters

a NDArray

The other operand.

b NDPolyBase

The 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

a NDPolyBase

The series.

b NDArray

A 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

a NDPolyBase

The series.

b Array

The 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

a NDPolyBase

The series.

b object

A 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

a NDPolyBase

The series.

b object[]

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

a NDPolyBase

The series.

b string

The 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

a Array

The other operand.

b NDPolyBase

The series.

Returns

NDPolyBase

The difference.

operator -(IList, NDPolyBase)

NumPy's other - p: the series' rsub.

public static NDPolyBase operator -(IList a, NDPolyBase b)

Parameters

a IList

The other operand.

b NDPolyBase

The series.

Returns

NDPolyBase

The difference.

operator -(object[], NDPolyBase)

NumPy's other - p: the series' rsub.

public static NDPolyBase operator -(object[] a, NDPolyBase b)

Parameters

a object[]

The other operand.

b NDPolyBase

The series.

Returns

NDPolyBase

The difference.

operator -(ITuple, NDPolyBase)

NumPy's other - p: the series' rsub.

public static NDPolyBase operator -(ITuple a, NDPolyBase b)

Parameters

a ITuple

The other operand.

b NDPolyBase

The series.

Returns

NDPolyBase

The difference.

operator -(string, NDPolyBase)

NumPy's other - p: the series' rsub.

public static NDPolyBase operator -(string a, NDPolyBase b)

Parameters

a string

The other operand.

b NDPolyBase

The series.

Returns

NDPolyBase

The difference.

operator -(NDPolyBase)

NumPy's -p.

public static NDPolyBase operator -(NDPolyBase a)

Parameters

a NDPolyBase

The series.

Returns

NDPolyBase

The negated series.

operator +(NDPolyBase)

NumPy's +p: the series itself (pos returns self).

public static NDPolyBase operator +(NDPolyBase a)

Parameters

a NDPolyBase

The series.

Returns

NDPolyBase

a.