Table of Contents

Class HermiteEModule

Namespace
NumSharp
Assembly
NumSharp.dll

numpy.polynomial.hermite_e — probabilists' Hermite series p(x) = c[0]*He_0(x) + c[1]*He_1(x) + …, reachable as np.polynomial.hermite_e. Coefficients are LOW degree first.

[ModuleName("np.polynomial.hermite_e")]
public class HermiteEModule
Inheritance
HermiteEModule
Inherited Members

Remarks

Properties

hermedomain

hermedomain — the default domain of the probabilists' Hermite series class, float64 [-1.0, 1.0].

public NDArray hermedomain { get; }

Property Value

NDArray

Remarks

NumPy's module constants are ordinary WRITEABLE ndarrays, the same object on every access, and so is this one: a process-wide instance (a write through it persists, as in NumPy). It is shared — do not dispose it (a dispose is harmless: the buffer is pinned for the process lifetime) and copy it before mutating unless the change is meant to be global.

https://numpy.org/doc/stable/reference/generated/numpy.polynomial.hermite_e.html

hermeone

hermeone — the probabilists' Hermite series representing 1, int64 [1] (shared and writeable, see hermedomain).

public NDArray hermeone { get; }

Property Value

NDArray

Remarks

hermex

hermex — the probabilists' Hermite series representing x, int64 [0, 1] (shared and writeable, see hermedomain).

public NDArray hermex { get; }

Property Value

NDArray

Remarks

hermezero

hermezero — the probabilists' Hermite series representing 0, int64 [0] (shared and writeable, see hermedomain).

public NDArray hermezero { get; }

Property Value

NDArray

Remarks

Methods

HermiteE(object, object, object, string)

NumPy's numpy.polynomial.hermite_e.HermiteE(coef, domain=None, window=None, symbol='x'): a (probabilists') HermiteE series — a new NDHermiteE (the class itself; its class methods fit, fromroots, identity, basis and cast are static members of NDHermiteE).

public NDHermiteE HermiteE(object coef, object domain = null, object window = null, string symbol = "x")

Parameters

coef object

The coefficients, low degree first (see NDHermiteE(object, object, object, string)).

domain object

The domain, or null for the class default.

window object

The window, or null for the class default.

symbol string

The variable's name for printing: a Python identifier.

Returns

NDHermiteE

The series (dispose it when done).

Remarks

Exceptions

ValueError

The constructor's errors (an empty or non-1-d series, a domain or window of the wrong length, an invalid symbol).

TypeError

A null symbol.

NotSupportedException

Coefficients NumPy keeps as an object array.

herme2poly(object)

Converts the Hermite_e series c to a power series — NumPy's backward recurrence over power-series ops (polyadd, polysub, polymulx) from the highest coefficient down; a series of one or two terms is returned as is. Keeps the series' common type. Bit-identical to NumPy 2.4.2's herme2poly.

public NDArray herme2poly(object c)

Parameters

c object

The Hermite_e series's coefficients. The coefficients, LOW degree first: an NDArray (any layout), a typed C# array, a Python list or tuple (object[], a ValueTuple, a jagged array — np.array's coercion), or a single number. Integer series are computed in float64; a bool series has no common type.

Returns

NDArray

The power-series coefficients, low degree first (a new array, or a view of one when trailing zeros were trimmed).

Remarks

Exceptions

ValueError

An empty series (Coefficient array is empty), a series that is not 1-d (Coefficient array is not 1-d), or no common type (a bool or str series), in NumPy's order; a ragged list (np.array's inhomogeneous-shape text).

NotSupportedException

A null series, or one holding None, a non-numeric object or a Python int past uint64 (NumPy's object array, a dtype NumSharp does not have) — raised where NumPy starts computing with it, after every series check. A str series is NumPy's ValueError (no common type).

hermeadd(object, object)

Adds two probabilists' Hermite series (polyutils._add): both converted to their common type (integers become float64), the shorter added into a copy of the longer, trailing zeros trimmed.

public NDArray hermeadd(object c1, object c2)

Parameters

c1 object

First series, low degree first (an array, a C# array or list, or a single number).

c2 object

Second series.

Returns

NDArray

The sum: a new array, or a VIEW of one when trailing zeros were trimmed (as in NumPy).

Remarks

Exceptions

ValueError

An empty or non-1-d series, or no common type (a bool series).

NotSupportedException

A null series, or one holding None, a non-numeric object or a Python int past uint64 (NumPy's object array), raised after both series' checks.

hermecompanion(object)

The scaled companion matrix of the (probabilists') HermiteE series c: the basis is scaled so that the matrix is symmetric when c is a single HermiteE polynomial — off-diagonals sqrt(k), and the last column reduced by scl * c[:-1] / c[-1], where scl is the reversed running product of 1 / sqrt(k) (NumPy's sequential np.multiply.accumulate). The scale vector is float64, so a float16 / float32 series' last column is computed in float64 and rounded once into the matrix; a complex series runs the complex128 loops. Bit-identical to NumPy 2.4.2's hermecompanion.

public NDArray hermecompanion(object c)

Parameters

c object

The coefficients, LOW degree first: an NDArray (any layout), a typed C# array, a Python list or tuple (object[], a ValueTuple, a jagged array — np.array's coercion), or a single number. Trailing zeros are trimmed first; integer series are computed in float64; a bool series has no common type.

Returns

NDArray

A new owning (deg, deg) matrix of the series' common type; a two-term series gives the 1x1 matrix [[-c[0] / c[1]]] (NumPy's arithmetic on the two coefficients: scalarmath, or — for an object series — the items' own: CPython for Python numbers, ufuncs for 0-d arrays; the 1x1 array is numeric either way).

Remarks

Exceptions

ValueError

An empty series (Coefficient array is empty), a series that is not 1-d (Coefficient array is not 1-d), or no common type (a bool or str series), in NumPy's order; a ragged list (np.array's inhomogeneous-shape text). Fewer than two terms after trimming: Series must have maximum degree of at least 1.

NotSupportedException

An OBJECT series (None, a non-numeric object or a Python int past uint64 among the terms makes NumPy's as_series copy an object array) of three or more terms after trimming whose arithmetic does not raise — NumPy's result is an object matrix, a dtype NumSharp does not have; or one where NumPy's object arithmetic reaches None or a str (CPython's TypeError there). A two-term object series of numbers computes: NumPy's linear root of the items is a numeric 1x1 array. A str series is NumPy's ValueError (no common type).

OverflowError

An object series whose arithmetic meets a Python int too large for a float — CPython's integer division result too large for a float when it is divided by a Python int, int too large to convert to float when it meets anything else — whichever NumPy's statements raise first.

hermeder(object, int, object, int)

Differentiates the probabilists' Hermite series c m times along axis, multiplying by scl at every order. Bit-identical to NumPy 2.4.2's hermeder: its recurrence der[j-1] = j*c[j], with c *= scl before every order, in NumPy's statement order and NEP 50 dtypes.

public NDArray hermeder(object c, int m = 1, object scl = null, int axis = 0)

Parameters

c object

The coefficients, LOW degree first (see polyder(object, int, object, int)).

m int

How many times to differentiate (≥ 0). 0 returns a copy. m >= len(c) returns c[:1]*0 — and, unlike the other five bases, NumPy's hermeder returns it WITHOUT moving the series axis back: for an N-D series with axis ≠ 0 that axis comes first in the result (a NumPy quirk, reproduced).

scl object

The multiplier applied at each order (null for NumPy's 1; a scalar or a broadcasting array).

axis int

The axis the series runs along (negative counts from the end).

Returns

NDArray

The derivative's coefficients, of the series' dtype (a view of a new array in NumPy's layout).

Remarks

Exceptions

ValueError

The order of derivation must be non-negative, or an array scl whose broadcast would stretch the series.

AxisError

axis is out of range.

TypeError

A scl the series cannot absorb in place (NumPy's UFuncTypeError).

IncorrectShapeException

An array scl that does not broadcast with the series.

NotSupportedException

A null or string series.

hermediv(object, object)

Divides the Hermite_e series c1 by c2, returning quotient and remainder: polyutils._div: for each quotient coefficient, the divisor times the i-th basis polynomial (hermemul([0]*i + [1], c2)) is scaled and subtracted from the remainder. A dividend shorter than the divisor gives (c1[:1]*0, c1), a one-term divisor (c1/c2[-1], c1[:1]*0). The quotient keeps the common type of the series, but the remainder is computed against divisor products NumPy promotes with an int list, so it is float64 for float16 / float32 series (probed 2.4.2). Bit-identical to NumPy 2.4.2's hermediv.

public (NDArray quo, NDArray rem) hermediv(object c1, object c2)

Parameters

c1 object

The dividend. The coefficients, LOW degree first: an NDArray (any layout), a typed C# array, a Python list or tuple (object[], a ValueTuple, a jagged array — np.array's coercion), or a single number. Integer series are computed in float64; a bool series has no common type.

c2 object

The divisor.

Returns

(NDArray Lhs, NDArray Rhs)

(quo, rem): NumPy's tuple, each a new array or a view of one.

Remarks

Exceptions

ValueError

An empty series (Coefficient array is empty), a series that is not 1-d (Coefficient array is not 1-d), or no common type (a bool or str series), in NumPy's order; a ragged list (np.array's inhomogeneous-shape text).

NotSupportedException

A null series, or one holding None, a non-numeric object or a Python int past uint64 (NumPy's object array, a dtype NumSharp does not have) — raised where NumPy starts computing with it, after every series check. A str series is NumPy's ValueError (no common type).

ZeroDivisionError

The divisor is zero (all its coefficients, after trimming) — NumPy's bare ZeroDivisionError, empty message.

hermefit(object, object, object, object, bool, object)

The least-squares fit of a HermiteE series to data: the coefficients c that minimise the weighted squared error sum_j w_j**2 * |y_j - hermeval(x_j, c)|**2, computed as NumPy 2.4.2 writes it (polyutils._fit: the hermevander(object, int) design matrix with its columns scaled to unit norm, solved by np.linalg.lstsq), so the coefficients are NumPy's bit for bit with the OpenBLAS backend NumPy loads.

public NDPolyFitResult hermefit(object x, object y, object deg, object rcond = null, bool full = false, object w = null)

Parameters

x object

The x-coordinates of the M sample points: anything np.asarray takes that is 1-D — a list, a typed C# array, an NDArray of any real or complex dtype (bool and integers compute in float64, float32 in float32).

y object

The y-coordinates: 1-D (M,), or 2-D (M, K) to fit K data sets that share the x-coordinates (one per column).

deg object

The degree of the fit: an integer (every term up to it is fitted), or a 1-D array_like of integer degrees (only those terms are fitted; the others are zero in the result). A bool, a float or an empty list is refused.

rcond object

The relative cutoff below which singular values of the scaled design matrix count as zero, or null for NumPy's default len(x)*eps of x's float dtype.

full bool

Also return the residuals, rank, singular values and rcond of the least-squares problem (NumPy's full=True): the result then deconstructs as (c, (residuals, rank, singular_values, rcond)).

w object

Weights of the sample points (1-D, length M), multiplying each point's residual, or null. For Gaussian uncertainties use 1/sigma.

Returns

NDPolyFitResult

The coefficients, low degree first, as an NDPolyFitResult: an NDArray of shape (deg + 1,) or (deg + 1, K) in the dtype lstsq computes in (float64; float32 for float32 x and y; complex128), carrying the statistics when full is true.

Remarks

NumPy warns (RankWarning: The fit may be poorly conditioned) when the rank falls short of the number of fitted terms and full is false; NumSharp emits no warnings — read rank with full: true.

https://numpy.org/doc/stable/reference/generated/numpy.polynomial.hermite_e.hermefit.html

Exceptions

TypeError

NumPy's argument TypeErrors (deg must be an int or non-empty 1-D array of int, expected 1D vector for x, expected non-empty vector for x, expected 1D or 2D array for y, expected x and y to have same length, expected 1D vector for w, expected x and w to have same length); a null x / y / w (Python's unsupported operand type(s) for +: 'NoneType' and 'float') or a str one (the ufunc add's no-loop text); a float16 x (lstsq's array type float16 is unsupported in linalg); a complex or str rcond.

ValueError

expected deg >= 0; np.asarray's inhomogeneous-shape text for a ragged list; a degree too large for the design matrix (Maximum allowed dimension exceeded, array is too big; …).

NotSupportedException

No LAPACK backend (np.linalg.lstsq needs NumSharp.Interop.OpenBLAS); an argument NumPy computes with as Python objects; an rcond array with one or more dimensions (NumPy broadcasts lstsq over it).

MemoryError

A design matrix the machine cannot hold (NumPy's MemoryError).

hermefromroots(object)

The Hermite_e series whose roots are roots: the roots sorted, one linear factor per root (hermeline(-r, 1) = [-r, 1]), multiplied pairwise as a balanced tree (polyutils._fromroots) with hermemul. Empty roots give [1.]. The factors are built by np.array([-r, …]), whose coercion promotes a float16 / float32 root to float64 — so the series is float64 (complex128 for complex roots). Bit-identical to NumPy 2.4.2's hermefromroots; one documented difference: roots that compare equal but differ in bits (+0.0 and -0.0) are ordered deterministically here, where NumPy's unstable SIMD sort decides by CPU, which can flip the sign of a zero coefficient.

public NDArray hermefromroots(object roots)

Parameters

roots object

The roots: an NDArray, a typed C# array, a Python list or tuple, … (anything with a length — NumPy's len(roots) runs first).

Returns

NDArray

A new array of len(roots) + 1 coefficients.

Remarks

Exceptions

TypeError

A scalar (object of type 'float' has no len()) or a 0-d array (len() of unsized object).

ValueError

Roots that are not 1-d, a zero-size array of nonzero length, or no common type (bool roots).

NotSupportedException

An object root array (None, or roots holding None, a non-numeric object or a Python int past uint64), raised after its checks; str roots are NumPy's ValueError (no common type).

hermegauss(object)

Gauss-HermiteE quadrature: the sample points x_k (the roots of He_deg, increasing) and weights w_k, so that Σ w_k f(x_k) integrates f(x)·exp(-x²/2) over the real line exactly for every polynomial f of degree up to 2deg - 1. Computed as NumPy 2.4.2 writes it: the eigenvalues of the (symmetric) companion matrix of He_deg, one Newton step on the NORMALISED HermiteE functions, the weights scaled against overflow, both symmetrised, and the weights normalised to sum to sqrt(2pi) — bit-identical to NumPy.

public (NDArray x, NDArray w) hermegauss(object deg)

Parameters

deg object

The number of points: an integer under Python's operator.index — a C# integer, BigInteger, bool or char, or a 0-d integer NDArray. A float, even an integral one, is refused. NumPy builds the series as [0] * deg + [1] from the argument itself, so a 0-d array (not a list repeat) gives the one-coefficient series [1] and the companion's ValueError.

Returns

(NDArray Lhs, NDArray Rhs)

(x, w): NumPy's tuple of two new float64 arrays of deg elements. As in NumPy, high degrees are garbage: from degree ~400 some weights are NaN (the scaled 1 / (fm * fm) overflows and the final scale is 0), from ~1000 some points too (the recurrence itself overflows at the outer nodes); NumPy's docstring vouches for degrees up to 100.

Remarks

NumPy evaluates each of its three normalised recurrences as a Python loop of six ufunc calls per degree; here each is one kernel pass over the points. From degree ~100 both sides are bound by the same LAPACK syevd.

https://numpy.org/doc/stable/reference/generated/numpy.polynomial.hermite_e.hermegauss.html

Exceptions

TypeError

deg must be an integer, received {deg}, with deg as NumPy's f-string formats it (received 3.0, received True for a 0-d bool array, received [3]).

ValueError

deg must be a positive integer; for a 0-d array deg the companion's Series must have maximum degree of at least 1.

OverflowError

A count past 2**63 - 1: CPython's cannot fit 'int' into an index-sized integer from the list repeat.

MemoryError

A count CPython's list cannot hold (2**60 - 1 or more: NumPy's empty MemoryError), or a companion matrix the machine cannot hold.

NotSupportedException

No LAPACK backend is installed: the eigenvalues are np.linalg.eigvalsh's, which needs NumSharp.Interop.OpenBLAS (bit-identical to NumPy with the OpenBLAS NumPy itself loads, at one thread).

InvalidOperationException

IL generation is disabled: the recurrence is an emitted kernel.

hermegrid2d(object, object, object)

Evaluates the 2-D probabilists' Hermite series on the Cartesian product of x and y (NumPy's _gridnd: two tensor passes). Unlike hermeval2d(object, object, object) the coordinates are NOT converted first, so a Python-scalar coordinate stays weak.

public NDArray hermegrid2d(object x, object y, object c)

Parameters

x object

First-axis points (array or Python scalar, as in hermeval(object, object, bool)).

y object

Second-axis points.

c object

Coefficients (anything np.array accepts — an NDArray of any layout, a typed C# array, a Python tuple / list such as a ValueTuple, object[] or a jagged / NDArray[] array, nested to any depth, or a scalar); c[i,j] is the coefficient of the degree (i, j) term.

Returns

NDArray

The grid, shape c.shape[2:] + x.shape + y.shape.

Remarks

Exceptions

ArgumentNullException

A coordinate (or pts) is null; a null c is NotSupportedException (NumPy's object array).

IndexError

c is empty along an evaluated axis.

ValueError

A ragged tuple / list c or point argument (np.array's inhomogeneous-shape text; c is converted before the first points).

NotSupportedException

A null or str c, or a tuple / list holding a str / null.

hermegrid3d(object, object, object, object)

Evaluates the 3-D probabilists' Hermite series on the Cartesian product of x, y and z (NumPy's _gridnd: three tensor passes).

public NDArray hermegrid3d(object x, object y, object z, object c)

Parameters

x object

First-axis points.

y object

Second-axis points.

z object

Third-axis points.

c object

Coefficients (anything np.array accepts — an NDArray of any layout, a typed C# array, a Python tuple / list such as a ValueTuple, object[] or a jagged / NDArray[] array, nested to any depth, or a scalar); c[i,j,k] is the coefficient of the degree (i, j, k) term.

Returns

NDArray

The grid, shape c.shape[3:] + x.shape + y.shape + z.shape.

Remarks

Exceptions

ArgumentNullException

A coordinate (or pts) is null; a null c is NotSupportedException (NumPy's object array).

IndexError

c is empty along an evaluated axis.

ValueError

A ragged tuple / list c or point argument (np.array's inhomogeneous-shape text; c is converted before the first points).

NotSupportedException

A null or str c, or a tuple / list holding a str / null.

hermeint(object, int, object, object, object, int)

Integrates the probabilists' Hermite series c m times along axis: each order multiplies by scl, integrates (tmp[j+1] = c[j]/(j+1)) and adds the constant that makes the new series equal k[i] at lbnd (tmp[0] += k[i] - hermeval(lbnd, tmp)). Bit-identical to NumPy 2.4.2's hermeint.

public NDArray hermeint(object c, int m = 1, object k = null, object lbnd = null, object scl = null, int axis = 0)

Parameters

c object

The coefficients, LOW degree first.

m int

How many times to integrate (≥ 0); 0 returns a copy.

k object

The integration constants (see polyint(object, int, object, object, object, int)).

lbnd object

The lower bound (null for NumPy's 0); a scalar.

scl object

The multiplier applied at each order (null for NumPy's 1); a scalar.

axis int

The axis the series runs along.

Returns

NDArray

The integral's coefficients, of the series' dtype (a view of a new array in NumPy's layout).

Remarks

Exceptions

ValueError

NumPy's argument checks (see polyint(object, int, object, object, object, int)).

AxisError

axis is out of range.

IndexError

An empty series.

TypeError

An array constant for a complex 1-D series (NumPy's complex() text).

TypeError

A value an N-D series cannot absorb in place (NumPy's UFuncTypeError).

IncorrectShapeException

Constants that do not broadcast with the series' columns.

NotSupportedException

A null or string series, constant or bound.

hermeline(object, object)

The probabilists' Hermite series of the line off + scl*x: [off, scl] when scl != 0, else [off] — built with np.array, so the dtype is the one NumPy DISCOVERS for the entries (hermeline(1, 2) is int64, hermeline(1.0, 2) float64, a bool pair stays bool) rather than a coefficient dtype.

public NDArray hermeline(object off, object scl)

Parameters

off object

The offset: a Python number (C# bool / integer / float / double / Complex), a NumPy scalar (Half, char, decimal, a 0-d NDArray) or an array.

scl object

The scale; its truth value scl != 0 picks the one- or two-coefficient form (NaN is nonzero).

Returns

NDArray

A new 1-D array (2-D when the entries are equal-shape arrays, as NumPy stacks them).

Remarks

Exceptions

ValueError

An array scale with several elements or none (NumPy's truth-value errors), or entries of different shapes (setting an array element with a sequence…).

TypeError

NumPy's boolean negative / subtract.

OverflowError

A Python int out of a NumPy integer dtype's range, or CPython's int/float overflow.

NotSupportedException

An entry NumPy would store in an object array: a Python int beyond uint64, null, a string.

hermemul(object, object)

Multiplies two Hermite_e series: NumPy's backward recurrence over series — for each coefficient of the shorter factor, c0 = hermesub(c[-i]xs, c1(nd-1)); c1 = hermeadd(tmp, hermemulx(c1)) — ending in hermeadd(c0, hermemulx(c1)). When either factor is a single term, NumPy's recurrence binds the Python int 0, so a float16 / float32 product is float64 (probed 2.4.2). Bit-identical to NumPy 2.4.2: every statement runs through the kernel NumPy's statement runs through (the house ufunc loops, the U1 combine, the mulx kernel) in NumPy's order and dtypes.

public NDArray hermemul(object c1, object c2)

Parameters

c1 object

First factor. The coefficients, LOW degree first: an NDArray (any layout), a typed C# array, a Python list or tuple (object[], a ValueTuple, a jagged array — np.array's coercion), or a single number. Integer series are computed in float64; a bool series has no common type.

c2 object

Second factor.

Returns

NDArray

The product: a new array, or a VIEW of one when trailing zeros were trimmed (as in NumPy).

Remarks

Exceptions

ValueError

An empty series (Coefficient array is empty), a series that is not 1-d (Coefficient array is not 1-d), or no common type (a bool or str series), in NumPy's order; a ragged list (np.array's inhomogeneous-shape text).

NotSupportedException

A null series, or one holding None, a non-numeric object or a Python int past uint64 (NumPy's object array, a dtype NumSharp does not have) — raised where NumPy starts computing with it, after every series check. A str series is NumPy's ValueError (no common type).

hermemulx(object)

Multiplies the Hermite_e series c by x: xHe_i = He_{i+1} + iHe_{i-1}: NumPy's prd[0] = c[0]*0; prd[1] = c[0], then prd[i+1] = c[i]; prd[i-1] += c[i]*i per coefficient. The zero series [0] is returned as is. Bit-identical to NumPy 2.4.2's hermemulx — one IL kernel pass where NumPy runs a Python loop.

public NDArray hermemulx(object c)

Parameters

c object

The coefficients, LOW degree first: an NDArray (any layout), a typed C# array, a Python list or tuple (object[], a ValueTuple, a jagged array — np.array's coercion), or a single number. Integer series are computed in float64; a bool series has no common type.

Returns

NDArray

A new array one coefficient longer (the zero series: a one-element copy), of np.common_type(c).

Remarks

Exceptions

ValueError

An empty series (Coefficient array is empty), a series that is not 1-d (Coefficient array is not 1-d), or no common type (a bool or str series), in NumPy's order; a ragged list (np.array's inhomogeneous-shape text).

NotSupportedException

A null series, or one holding None, a non-numeric object or a Python int past uint64 (NumPy's object array, a dtype NumSharp does not have) — raised where NumPy starts computing with it, after every series check. A str series is NumPy's ValueError (no common type).

hermepow(object, int, int?)

Raises the Hermite_e series c to the power pow: [1] of the series' dtype for 0, the (trimmed) series for 1, otherwise hermemul applied pow - 1 times. Bit-identical to NumPy 2.4.2's hermepow.

public NDArray hermepow(object c, int pow, int? maxpower = 16)

Parameters

c object

The coefficients, LOW degree first: an NDArray (any layout), a typed C# array, a Python list or tuple (object[], a ValueTuple, a jagged array — np.array's coercion), or a single number. Integer series are computed in float64; a bool series has no common type.

pow int

The power (≥ 0).

maxpower int?

The largest power allowed: 16; null for no limit. NumPy's default keeps an accidental huge power from running away.

Returns

NDArray

The power series, a new array of np.common_type(c).

Remarks

Exceptions

ValueError

The series' errors (see hermemul(object, object)), then Power must be a non-negative integer., then Power is too large — NumPy's order.

NotSupportedException

An object series (see hermemul(object, object)), raised after the power checks.

hermeroots(object)

The roots of the HermiteE series c: the eigenvalues of hermecompanion(c)[::-1, ::-1] — the ROTATED companion matrix, which NumPy notes reduces the error, computed by eigvals(NDArray) and sorted in place, ascending (complex numbers lexicographically, real part first). A constant series has no roots — an empty array of its dtype — and a linear one the single root -c[0] / c[1] (scalarmath, in its own dtype). Roots far from the origin, and multiple roots, carry larger errors (NumPy's documented caveat). With NumSharp.Interop.OpenBLAS referenced the eigenvalues come from NumPy's own LAPACK geev and are bit-identical to NumPy 2.4.2's hermeroots (one BLAS thread); where +0.0 and -0.0 roots meet, NumPy's SIMD sort orders them by CPU and NumSharp's sort deterministically.

public NDArray hermeroots(object c)

Parameters

c object

The coefficients, LOW degree first: an NDArray (any layout), a typed C# array, a Python list or tuple (object[], a ValueTuple, a jagged array — np.array's coercion), or a single number. Trailing zeros are trimmed first; integer series are computed in float64; a bool series has no common type.

Returns

NDArray

The sorted roots: for degree 2 or more the eigenvalue array eigvals(NDArray) returned, sorted in place — always complex128 since NumPy 2.5 (real roots carry zero imaginary parts; NumPy's complex64 for a float32 series: NumSharp has one complex width); a linear series' single root keeps the series dtype.

Remarks

Exceptions

ValueError

An empty series (Coefficient array is empty), a series that is not 1-d (Coefficient array is not 1-d), or no common type (a bool or str series), in NumPy's order; a ragged list (np.array's inhomogeneous-shape text).

TypeError

A float16 (or decimal) series of degree 2 or more: linalg's array type float16 is unsupported in linalg. An OBJECT series of three or more terms whose arithmetic does not raise: eigvals' ufunc 'isfinite' not supported for the input types, … on NumPy's object companion matrix (raised before LAPACK — no backend needed).

LinAlgError

A companion matrix holding an infinity or NaN (Array must not contain infs or NaNs, checked before the dtype), or eigenvalues that do not converge.

MissingBackendException

Degree 2 or more with no LAPACK backend: reference NumSharp.Interop.OpenBLAS (NumSharp.Core ships no eigensolver).

NotSupportedException

An OBJECT series (None, a non-numeric object or a Python int past uint64 among the terms) of one term — NumPy returns np.array([], dtype=object) — or one where NumPy's object arithmetic reaches None or a str (CPython's TypeError there). A two-term object series of numbers computes: NumPy's linear root of the items is a numeric array.

OverflowError

An object series whose arithmetic meets a Python int too large for a float — CPython's integer division result too large for a float when it is divided by a Python int, int too large to convert to float when it meets anything else — whichever NumPy's statements raise first.

hermesub(object, object)

Subtracts the probabilists' Hermite series c2 from c1 (polyutils._sub): both converted to their common type; when c2 is at least as long it is NEGATED first and c1 added into it (NumPy's operation order, visible in which NaN survives), then trailing zeros are trimmed.

public NDArray hermesub(object c1, object c2)

Parameters

c1 object

Minuend series, low degree first.

c2 object

Subtrahend series.

Returns

NDArray

The difference: a new array, or a VIEW of one when trailing zeros were trimmed.

Remarks

Exceptions

ValueError

An empty or non-1-d series, or no common type (a bool series).

NotSupportedException

A null series, or one holding None, a non-numeric object or a Python int past uint64 (NumPy's object array), raised after both series' checks.

hermetrim(object, double)

hermetrim — NumPy's alias of trimcoef(object, double): removes the trailing coefficients whose magnitude is at most tol (np.abs(c) > tol decides what stays) and returns the rest as a fresh copy of the coefficient dtype; when nothing exceeds the tolerance the result is c[:1]*0.

public NDArray hermetrim(object c, double tol = 0)

Parameters

c object

The series (1-D).

tol double

The non-negative tolerance, NumPy's Python number (0, the default, trims only exact zeros): it adopts the coefficients' precision, so a float16 series compares against the float16-rounded tolerance; a NaN tolerance trims everything.

Returns

NDArray

The trimmed copy (c[:1]*0 when nothing exceeds the tolerance).

Remarks

https://numpy.org/doc/stable/reference/generated/numpy.polynomial.hermite_e.hermetrim.html

API-parity batch 11 (the owner's decision 2, typed parameters only): one signature with NumPy's default; the (object c) and (object c, object tol) forms went, so a NumPy scalar or a 0-d array tolerance (compared in the promoted dtype) is no longer a C# spelling - pass the number.

Exceptions

ValueError

tol must be non-negative, an empty or non-1-d series, or no common type.

hermeval(object, object, bool)

Evaluates the probabilists' Hermite series with coefficients c at x by Clenshaw's recurrence exactly as NumPy writes it (c0 = c[-i] - c1*(nd - 1); c1 = tmp + c1x; return c0 + c1x), bit-identical to NumPy 2.4.2: the first steps run in the COEFFICIENTS' dtype exactly as NumPy's do, and every intermediate carries NumPy's NEP 50 dtype.

public NDArray hermeval(object x, object c, bool tensor = true)

Parameters

x object

The points. An NDArray (any layout) or a C# array is an array; a C# bool, integer, float, double or Complex is a Python scalar — it adopts the coefficients' dtype (hermeval(2.0, float32_c) is float32), Python-level arithmetic on it (2*x, 1 - x) is done in double as CPython does, and a 1-D series then yields a 0-d result. char/Half/decimal are strong 0-d arrays.

c object

Coefficients (anything np.array accepts — an NDArray of any layout, a typed C# array, a Python tuple / list such as a ValueTuple, object[] or a jagged / NDArray[] array, nested to any depth, or a scalar), low degree first; for an N-D array the series run along axis 0 and the other axes index independent series. Integer and bool coefficients are evaluated as float64.

tensor bool

When true (the default) and x is an array, every series is evaluated at every point and the result has shape c.shape[1:] + x.shape; when false x is broadcast over the series (c.shape[1:] against x.shape). Irrelevant for a 1-D series or a scalar x.

Returns

NDArray

The values, of NumPy's result dtype.

Remarks

Exceptions

ArgumentNullException

x is null.

ValueError

A ragged tuple / list c or x (np.array's inhomogeneous-shape text; c is converted first, so its error wins).

NotSupportedException

A null or str c, or a tuple / list holding a str or null (NumPy builds an object / str array, dtypes NumSharp does not have).

IndexError

c is empty: index -2 is out of bounds for axis 0 with size 0.

IncorrectShapeException

tensor is false and the shapes do not broadcast (NumPy's ValueError text).

OverflowError

A Python int of the recurrence does not fit an integer x dtype (NumPy's OverflowError).

hermeval2d(object, object, object)

Evaluates the 2-D probabilists' Hermite series Σ c[i,j] * He_i(x) * He_j(y) at the point pairs (x, y). NumPy's _valnd: hermeval(x, c) then hermeval(y, ·, tensor=False) — its exact intermediate, so the bits match.

public NDArray hermeval2d(object x, object y, object c)

Parameters

x object

First coordinates: an NDArray, a typed C# array, a Python tuple / list (np.array's coercion) or a scalar, converted before anything else (NumPy's np.asanyarray) — so a scalar is a STRONG 0-d array (a Python int an int64 one).

y object

Second coordinates (converted like x); must have x's shape.

c object

Coefficients (anything np.array accepts — an NDArray of any layout, a typed C# array, a Python tuple / list such as a ValueTuple, object[] or a jagged / NDArray[] array, nested to any depth, or a scalar); c[i,j] is the coefficient of the degree (i, j) term. Extra trailing axes index independent series (they lead the result's shape).

Returns

NDArray

The values, shape c.shape[2:] + x.shape.

Remarks

Exceptions

ArgumentNullException

A coordinate (or pts) is null; a null c is NotSupportedException (NumPy's object array).

ValueError

x and y differ in shape (x, y are incompatible), or a tuple / list argument is ragged (np.array's inhomogeneous-shape text: the coordinates' before the shape check, c's after it).

NotSupportedException

A null or str c, a str coordinate, or a tuple / list holding one (NumPy's object / str arrays).

IndexError

c is empty along axis 0.

hermeval3d(object, object, object, object)

Evaluates the 3-D probabilists' Hermite series at the point triples (x, y, z) (NumPy's _valnd: one tensor pass, then two per-point passes).

public NDArray hermeval3d(object x, object y, object z, object c)

Parameters

x object

First coordinates: an NDArray, a typed C# array, a Python tuple / list (np.array's coercion) or a scalar, converted before anything else (NumPy's np.asanyarray) — so a scalar is a STRONG 0-d array (a Python int an int64 one).

y object

Second coordinates (converted like x; x's shape).

z object

Third coordinates (converted like x; x's shape).

c object

Coefficients (anything np.array accepts — an NDArray of any layout, a typed C# array, a Python tuple / list such as a ValueTuple, object[] or a jagged / NDArray[] array, nested to any depth, or a scalar); c[i,j,k] is the coefficient of the degree (i, j, k) term.

Returns

NDArray

The values, shape c.shape[3:] + x.shape.

Remarks

Exceptions

ArgumentNullException

A coordinate (or pts) is null; a null c is NotSupportedException (NumPy's object array).

ValueError

The coordinates differ in shape (x, y, z are incompatible), or a tuple / list argument is ragged (the coordinates' before the shape check, c's after it).

NotSupportedException

A null or str c, a str coordinate, or a tuple / list holding one (NumPy's object / str arrays).

IndexError

c is empty along axis 0.

hermevalnd(object[], object)

Evaluates the N-D probabilists' Hermite series at the points pts = (x, y, …) — the n-dimensional hermeval2d(object, object, object). NumPy 2.5's addition (gh-30857): pu._valnd(hermeval, c, *pts), the computation NumPy 2.4 kept private as polyutils._valnd.

public NDArray hermevalnd(object[] pts, object c)

Parameters

pts object[]

The coordinates, all of one shape (one per series axis evaluated): each an NDArray, a typed C# array, a Python tuple / list or a scalar, converted first as in _valnd (a scalar is a STRONG 0-d array). An NDArray[] passes as it is.

c object

Coefficients (anything np.array accepts — an NDArray of any layout, a typed C# array, a Python tuple / list such as a ValueTuple, object[] or a jagged / NDArray[] array, nested to any depth, or a scalar); axis i is pts[i]'s degree.

Returns

NDArray

The values, shape c.shape[len(pts):] + pts[0].shape.

Remarks

Exceptions

ArgumentNullException

A coordinate (or pts) is null; a null c is NotSupportedException (NumPy's object array).

IndexError

pts is empty (list index out of range).

ValueError

The coordinates differ in shape, or a tuple / list argument is ragged.

NotSupportedException

A null or str c, or a str coordinate.

hermevander(object, int)

The pseudo-Vandermonde matrix of degree deg: V[..., i] = He_i(x) (probabilists' Hermite), by NumPy's forward recurrence v[0] = x*0 + 1; v[1] = x; v[i] = v[i-1]x - v[i-2](i - 1). Bit-identical to NumPy 2.4.2's hermevander (one IL kernel pass).

public NDArray hermevander(object x, int deg)

Parameters

x object

The points (see polyvander(object, int): any layout; the matrix dtype is (x + 0.0).dtype).

deg int

The degree (≥ 0).

Returns

NDArray

A view of shape x.shape + (deg + 1,) over a new array, the degree axis last (OWNDATA false).

Remarks

Exceptions

ValueError

deg must be non-negative; a ragged list x; array is too big; ….

MemoryError

The matrix cannot be allocated (NumPy's MemoryError).

NotSupportedException

A null or str x, or a list NumPy makes a str / object array of.

hermevander2d(object, object, object)

The 2-D pseudo-Vandermonde matrix: column a*(deg[1] + 1) + b is He_a(x) * He_b(y) — NumPy's _vander_nd_flat outer product of the two 1-D matrices. Bit-identical to NumPy 2.4.2's hermevander2d.

public NDArray hermevander2d(object x, object y, object deg)

Parameters

x object

The first coordinates (stacked with y: one shape, one promoted dtype — see polyvander2d(object, object, object)).

y object

The second coordinates.

deg object

The two degrees [x_deg, y_deg].

Returns

NDArray

A view of shape x.shape + ((deg[0] + 1) * (deg[1] + 1),) over a new array.

Remarks

Exceptions

TypeError

A deg without a length, or a non-integer degree.

ValueError

Expected 2 dimensions of degrees, got {len}; points of different shapes; deg must be non-negative; array is too big; ….

IncorrectShapeException

No points (NumPy's reshape text).

MemoryError

A matrix NumPy allocates on the way cannot be allocated.

OverflowError

Scalar points with a Python int past the float range (NumPy's int too large to convert to float at its per-element + 0.0).

NotSupportedException

Points NumPy stacks into a str array, or into an object array it computes with as Python objects or fails on. Scalar points that are all numbers but stack into an object array (a Python int past uint64 among them) ARE computed: each dimension gets its own number, as in NumPy.

hermevander3d(object, object, object, object)

The 3-D pseudo-Vandermonde matrix: column (a*(deg[1] + 1) + b)*(deg[2] + 1) + c is He_a(x) * He_b(y) * He_c(z), the first product rounded before the second (NumPy's reduce). Bit-identical to NumPy 2.4.2's hermevander3d.

public NDArray hermevander3d(object x, object y, object z, object deg)

Parameters

x object

The first coordinates (x, y, z stacked: one shape).

y object

The second coordinates.

z object

The third coordinates.

deg object

The three degrees.

Returns

NDArray

A view of shape x.shape + ((deg[0] + 1) * (deg[1] + 1) * (deg[2] + 1),) over a new array.

Remarks

Exceptions

TypeError

A deg without a length, or a non-integer degree.

ValueError

Expected 3 dimensions of degrees, got {len}, and the 2-D form's other errors.

IncorrectShapeException

No points (NumPy's reshape text).

MemoryError

A matrix NumPy allocates on the way cannot be allocated.

OverflowError

Scalar points with a Python int past the float range (NumPy's int too large to convert to float at its per-element + 0.0).

NotSupportedException

Points NumPy stacks into a str array, or into an object array it computes with as Python objects or fails on. Scalar points that are all numbers but stack into an object array (a Python int past uint64 among them) ARE computed: each dimension gets its own number, as in NumPy.

hermeweight(object)

The probabilists' Hermite weight function exp(-x2/2), computed as NumPy 2.4.2 writes it, np.exp(-.5*x2). For an ndarray, NumPy's x**2 is np.square in x's OWN dtype, so an integer x wraps before the Python float -0.5 promotes the product to float64. An ndarray is computed in one fused pass.

public NDArray hermeweight(object x)

Parameters

x object

The points: an NDArray of any layout and dtype, or a typed C# array (an ndarray); a Python scalar — a C# bool, integer, BigInteger, float, double or Complex, computed with CPython's arithmetic before np.exp (hermeweight(270) is 0.0: the square is an exact int, and -.5* it a float); or a NumPy scalar (Half, char, decimal). x is not converted first, so a Python list or tuple is refused by Python's .

Returns

NDArray

The weights: an array of x's shape for an ndarray x (float64 for an integer or bool x, x's own dtype for a float or complex x), a 0-d array for a scalar x.

Remarks

Exceptions

TypeError

x is a Python list or tuple (an object[], a C# list, a ValueTuple), null or a string: Python's unsupported operand type(s) for ** or pow(): 'list' and 'int' ('tuple', 'NoneType', 'str'). A string array: np.square's no-loop error.

OverflowError

A Python float or complex whose square is past the float range (CPython's (34, 'Result too large') or complex exponentiation), or a Python int whose square is too large for a float (int too large to convert to float from -.5*x**2).

OverflowException

A decimal x whose square is past decimal's range (decimal has no NumPy dtype and no infinity: .NET's own).

poly2herme(object)

Converts the power series pol to a Hermite_e series — Horner's scheme over the Hermite_e series's own ops: res = hermeadd(hermemulx(res), pol[i]) from the highest coefficient down, starting from the Python int 0, which makes the result float64 for any real series (complex128 for a complex one). Bit-identical to NumPy 2.4.2's poly2herme.

public NDArray poly2herme(object pol)

Parameters

pol object

The power-series coefficients. The coefficients, LOW degree first: an NDArray (any layout), a typed C# array, a Python list or tuple (object[], a ValueTuple, a jagged array — np.array's coercion), or a single number. Integer series are computed in float64; a bool series has no common type.

Returns

NDArray

The Hermite_e series's coefficients, low degree first (a new array, or a view of one when trailing zeros were trimmed).

Remarks

Exceptions

ValueError

An empty series (Coefficient array is empty), a series that is not 1-d (Coefficient array is not 1-d), or no common type (a bool or str series), in NumPy's order; a ragged list (np.array's inhomogeneous-shape text).

NotSupportedException

A null series, or one holding None, a non-numeric object or a Python int past uint64 (NumPy's object array, a dtype NumSharp does not have) — raised where NumPy starts computing with it, after every series check. A str series is NumPy's ValueError (no common type).