Class LaguerreModule
- Namespace
- NumSharp
- Assembly
- NumSharp.dll
numpy.polynomial.laguerre — Laguerre series p(x) = c[0]*L_0(x) + c[1]*L_1(x) + …, reachable as
np.polynomial.laguerre. Coefficients are LOW degree first.
[ModuleName("np.polynomial.laguerre")]
public class LaguerreModule
- Inheritance
-
LaguerreModule
- Inherited Members
Remarks
Properties
lagdomain
lagdomain — the default domain of the Laguerre series class, float64 [0.0, 1.0].
public NDArray lagdomain { get; }
Property Value
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.laguerre.html
lagone
lagone — the Laguerre series representing 1, int64 [1] (shared and writeable, see lagdomain).
public NDArray lagone { get; }
Property Value
Remarks
lagx
lagx — the Laguerre series representing x, int64 [1, -1] (x = L_0 - L_1) (shared and writeable, see lagdomain).
public NDArray lagx { get; }
Property Value
Remarks
lagzero
lagzero — the Laguerre series representing 0, int64 [0] (shared and writeable, see lagdomain).
public NDArray lagzero { get; }
Property Value
Remarks
Methods
Laguerre(object, object, object, string)
NumPy's numpy.polynomial.laguerre.Laguerre(coef, domain=None, window=None, symbol='x'): a Laguerre series — a new
NDLaguerre (the class itself; its class methods fit, fromroots, identity,
basis and cast are static members of NDLaguerre).
public NDLaguerre Laguerre(object coef, object domain = null, object window = null, string symbol = "x")
Parameters
coefobjectThe coefficients, low degree first (see NDLaguerre(object, object, object, string)).
domainobjectThe domain, or null for the class default.
windowobjectThe window, or null for the class default.
symbolstringThe variable's name for printing: a Python identifier.
Returns
- NDLaguerre
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.
lag2poly(object)
Converts the Laguerre series c to a power series — NumPy's backward recurrence over power-series
ops (polyadd, polysub, polymulx) from the highest coefficient down; a one-term series is returned as is. Keeps the
series' common type. Bit-identical to NumPy 2.4.2's lag2poly.
public NDArray lag2poly(object c)
Parameters
cobjectThe Laguerre series's coefficients. The coefficients, LOW degree first: an NDArray (any layout), a typed C# array, a Python list or tuple (
object[], aValueTuple, 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).
lagadd(object, object)
Adds two Laguerre 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 lagadd(object c1, object c2)
Parameters
c1objectFirst series, low degree first (an array, a C# array or list, or a single number).
c2objectSecond 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.
lagcompanion(object)
The companion matrix of the Laguerre series c: tridiagonal and symmetric, 2k + 1 on the diagonal and -k on both off-diagonals, the last column increased by (c[:-1] / c[-1]) * n. Every value of the update stays in the series' common type (the Python int n is weak), while the diagonals are int64 / float64 values cast by assignment. Bit-identical to NumPy 2.4.2's lagcompanion.
public NDArray lagcompanion(object c)
Parameters
cobjectThe coefficients, LOW degree first: an NDArray (any layout), a typed C# array, a Python list or tuple (
object[], aValueTuple, 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
[[1 + 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 floatwhen it is divided by a Python int,int too large to convert to floatwhen it meets anything else — whichever NumPy's statements raise first.
lagder(object, int, object, int)
Differentiates the Laguerre series c m times along axis,
multiplying by scl at every order. Bit-identical to NumPy 2.4.2's lagder: its
recurrence der[j-1] = -c[j]; c[j-1] += c[j] (then der[0] = -c[1]), with c *= scl before
every order, in NumPy's statement order and NEP 50 dtypes.
public NDArray lagder(object c, int m = 1, object scl = null, int axis = 0)
Parameters
cobjectThe coefficients, LOW degree first (see polyder(object, int, object, int)).
mintHow many times to differentiate (≥ 0). 0 returns a copy;
m >= len(c)returnsc[:1]*0.sclobjectThe multiplier applied at each order (null for NumPy's 1; a scalar or a broadcasting array).
axisintThe 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
axisis 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.
lagdiv(object, object)
Divides the Laguerre series c1 by c2, returning quotient and remainder:
polyutils._div: for each quotient coefficient, the divisor times the i-th basis polynomial (lagmul([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 lagdiv.
public (NDArray quo, NDArray rem) lagdiv(object c1, object c2)
Parameters
c1objectThe dividend. The coefficients, LOW degree first: an NDArray (any layout), a typed C# array, a Python list or tuple (
object[], aValueTuple, a jagged array — np.array's coercion), or a single number. Integer series are computed in float64; a bool series has no common type.c2objectThe divisor.
Returns
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.
lagfit(object, object, object, object, bool, object)
The least-squares fit of a Laguerre series to data: the coefficients c that minimise the weighted squared error
sum_j w_j**2 * |y_j - lagval(x_j, c)|**2, computed as NumPy 2.4.2 writes it (polyutils._fit: the
lagvander(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 lagfit(object x, object y, object deg, object rcond = null, bool full = false, object w = null)
Parameters
xobjectThe x-coordinates of the M sample points: anything
np.asarraytakes 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).yobjectThe y-coordinates: 1-D (M,), or 2-D (M, K) to fit K data sets that share the x-coordinates (one per column).
degobjectThe 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.
rcondobjectThe relative cutoff below which singular values of the scaled design matrix count as zero, or null for NumPy's default
len(x)*epsof x's float dtype.fullboolAlso 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)).wobjectWeights 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
fullis 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.laguerre.lagfit.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'sunsupported operand type(s) for +: 'NoneType' and 'float') or a str one (the ufunc add's no-loop text); a float16 x (lstsq'sarray 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.lstsqneedsNumSharp.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).
lagfromroots(object)
The Laguerre series whose roots are roots: the roots sorted, one linear factor per root
(lagline(-r, 1) = [1 - r, -1]), multiplied pairwise as a balanced tree (polyutils._fromroots) with lagmul.
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 lagfromroots; 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 lagfromroots(object roots)
Parameters
rootsobjectThe 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) + 1coefficients.
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).
laggauss(object)
Gauss-Laguerre quadrature: the sample points x_k (the roots of L_deg, increasing, all positive) and
weights w_k, so that Σ w_k f(x_k) integrates f(x)·exp(-x) over [0, inf) exactly for every
polynomial of degree up to 2*deg - 1. Computed as NumPy 2.4.2 writes it: the eigenvalues of the
(symmetric) companion matrix of L_deg, one Newton step, the weights scaled against overflow and normalised
to sum to 1 — bit-identical to NumPy.
public (NDArray x, NDArray w) laggauss(object deg)
Parameters
degobjectThe number of points: an integer under Python's
operator.index(seeleggauss; a 0-d array gives the companion's ValueError, as in NumPy).
Returns
Remarks
Unlike leggauss there is no symmetrisation (the Laguerre nodes are not symmetric). From degree
~100 both sides are bound by the same LAPACK syevd.
https://numpy.org/doc/stable/reference/generated/numpy.polynomial.laguerre.laggauss.html
Exceptions
- TypeError
deg must be an integer, received {deg}.- ValueError
deg must be a positive integer; for a 0-d arraydegthe companion'sSeries must have maximum degree of at least 1.- OverflowError
A count past 2**63 - 1 (CPython's list repeat).
- MemoryError
A count CPython's list cannot hold, or a companion matrix the machine cannot hold.
- NotSupportedException
No LAPACK backend is installed (
np.linalg.eigvalshneedsNumSharp.Interop.OpenBLAS).
laggrid2d(object, object, object)
Evaluates the 2-D Laguerre series on the Cartesian product of x and y
(NumPy's _gridnd: two tensor passes). Unlike lagval2d(object, object, object) the coordinates are NOT
converted first, so a Python-scalar coordinate stays weak.
public NDArray laggrid2d(object x, object y, object c)
Parameters
xobjectFirst-axis points (array or Python scalar, as in lagval(object, object, bool)).
yobjectSecond-axis points.
cobjectCoefficients (anything
np.arrayaccepts — 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
cis 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.
laggrid3d(object, object, object, object)
Evaluates the 3-D Laguerre series on the Cartesian product of x, y and
z (NumPy's _gridnd: three tensor passes).
public NDArray laggrid3d(object x, object y, object z, object c)
Parameters
xobjectFirst-axis points.
yobjectSecond-axis points.
zobjectThird-axis points.
cobjectCoefficients (anything
np.arrayaccepts — 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
cis 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.
lagint(object, int, object, object, object, int)
Integrates the Laguerre series c m times along axis:
each order multiplies by scl, integrates (tmp[0] = c[0]; tmp[1] = -c[0];
tmp[j] += c[j]; tmp[j+1] = -c[j]) and adds the constant that makes the new series equal k[i] at
lbnd (tmp[0] += k[i] - lagval(lbnd, tmp)). Bit-identical to NumPy 2.4.2's
lagint.
public NDArray lagint(object c, int m = 1, object k = null, object lbnd = null, object scl = null, int axis = 0)
Parameters
cobjectThe coefficients, LOW degree first.
mintHow many times to integrate (≥ 0); 0 returns a copy.
kobjectThe integration constants (see polyint(object, int, object, object, object, int)).
lbndobjectThe lower bound (null for NumPy's 0); a scalar.
sclobjectThe multiplier applied at each order (null for NumPy's 1); a scalar.
axisintThe 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
axisis 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.
lagline(object, object)
The Laguerre series of the line off + scl*x: [off + scl, -scl] when scl != 0, else [off] — built
with np.array, so the dtype is the one NumPy DISCOVERS for the entries (lagline(1, 2) is int64,
lagline(1.0, 2) float64, a bool pair stays bool) rather than a coefficient dtype.
Laguerre's entries are computed BEFORE the array is built, with Python's / NumPy's operators:
lagline(np.int8(100), np.int8(100)) wraps to [-56, -100], and a NumPy bool scale raises
NumPy's boolean-negative TypeError.
public NDArray lagline(object off, object scl)
Parameters
offobjectThe offset: a Python number (C# bool / integer / float / double / Complex), a NumPy scalar (Half,
char,decimal, a 0-d NDArray) or an array.sclobjectThe scale; its truth value
scl != 0picks 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.
lagmul(object, object)
Multiplies two Laguerre series: NumPy's backward recurrence over series — for each coefficient of the shorter factor, c0 = lagsub(c[-i]xs, (c1(nd-1))/nd); c1 = lagadd(tmp, lagsub((2*nd-1)*c1, lagmulx(c1))/nd) — ending in lagadd(c0, lagsub(c1, lagmulx(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 lagmul(object c1, object c2)
Parameters
c1objectFirst factor. The coefficients, LOW degree first: an NDArray (any layout), a typed C# array, a Python list or tuple (
object[], aValueTuple, a jagged array — np.array's coercion), or a single number. Integer series are computed in float64; a bool series has no common type.c2objectSecond 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).
lagmulx(object)
Multiplies the Laguerre series c by x: xL_i = -(i+1)L_{i+1} + (2i+1)L_i - iL_{i-1}: NumPy's prd[0] = c[0]; prd[1] = -c[0], then prd[i+1] = -c[i](i+1); prd[i] += c[i](2i+1); prd[i-1] -= c[i]*i per coefficient. The zero series [0] is returned as is.
Bit-identical to NumPy 2.4.2's lagmulx — one IL kernel pass where NumPy runs a Python loop.
public NDArray lagmulx(object c)
Parameters
cobjectThe coefficients, LOW degree first: an NDArray (any layout), a typed C# array, a Python list or tuple (
object[], aValueTuple, 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).
lagpow(object, int, int?)
Raises the Laguerre series c to the power pow: [1] of the series' dtype
for 0, the (trimmed) series for 1, otherwise lagmul applied pow - 1 times. Bit-identical to NumPy 2.4.2's lagpow.
public NDArray lagpow(object c, int pow, int? maxpower = 16)
Parameters
cobjectThe coefficients, LOW degree first: an NDArray (any layout), a typed C# array, a Python list or tuple (
object[], aValueTuple, a jagged array — np.array's coercion), or a single number. Integer series are computed in float64; a bool series has no common type.powintThe power (≥ 0).
maxpowerint?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 lagmul(object, object)), then
Power must be a non-negative integer., thenPower is too large— NumPy's order.- NotSupportedException
An object series (see lagmul(object, object)), raised after the power checks.
lagroots(object)
The roots of the Laguerre series c: the eigenvalues of lagcompanion(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
1 + 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 lagroots (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 lagroots(object c)
Parameters
cobjectThe coefficients, LOW degree first: an NDArray (any layout), a typed C# array, a Python list or tuple (
object[], aValueTuple, 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: REAL when every eigenvalue is — NumPy 2.5's
_to_real_if_imag_zeroover the always complex eigvals: a view of the eigenvalues' real parts (OWNDATA false, every other element of its buffer, as NumPy'sw.real), float64 for a float64 series and float32 for a float32 one — otherwise complex128 (NumPy's complex64 for a float32 series: NumSharp has one complex width).
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 floatwhen it is divided by a Python int,int too large to convert to floatwhen it meets anything else — whichever NumPy's statements raise first.
lagsub(object, object)
Subtracts the Laguerre 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 lagsub(object c1, object c2)
Parameters
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.
lagtrim(object, double)
lagtrim — 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 lagtrim(object c, double tol = 0)
Parameters
cobjectThe series (1-D).
toldoubleThe 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]*0when nothing exceeds the tolerance).
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.polynomial.laguerre.lagtrim.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.
lagval(object, object, bool)
Evaluates the Laguerre series with coefficients c at x by Clenshaw's recurrence exactly as NumPy writes it (c0 = c[-i] - (c1*(nd - 1))/nd; c1 = tmp + (c1*((2nd - 1) - x))/nd; return c0 + c1(1 - x)) — two divisions per step,
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 lagval(object x, object c, bool tensor = true)
Parameters
xobjectThe points. An NDArray (any layout) or a C# array is an array; a C#
bool, integer,float,doubleor Complex is a Python scalar — it adopts the coefficients' dtype (lagval(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/decimalare strong 0-d arrays.cobjectCoefficients (anything
np.arrayaccepts — 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.tensorboolWhen 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:]againstx.shape). Irrelevant for a 1-D series or a scalar x.
Returns
- NDArray
The values, of NumPy's result dtype.
Remarks
Exceptions
- ArgumentNullException
xis null.- ValueError
A ragged tuple / list
corx(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
cis empty:index -2 is out of bounds for axis 0 with size 0.- IncorrectShapeException
tensoris 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).
lagval2d(object, object, object)
Evaluates the 2-D Laguerre series Σ c[i,j] * L_i(x) * L_j(y) at the point pairs (x, y).
NumPy's _valnd: lagval(x, c) then lagval(y, ·, tensor=False) — its exact
intermediate, so the bits match.
public NDArray lagval2d(object x, object y, object c)
Parameters
xobjectFirst 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).yobjectSecond coordinates (converted like
x); must have x's shape.cobjectCoefficients (anything
np.arrayaccepts — 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
cis empty along axis 0.
lagval3d(object, object, object, object)
Evaluates the 3-D Laguerre series at the point triples (x, y, z) (NumPy's _valnd: one tensor
pass, then two per-point passes).
public NDArray lagval3d(object x, object y, object z, object c)
Parameters
xobjectFirst 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).yobjectSecond coordinates (converted like
x; x's shape).zobjectThird coordinates (converted like
x; x's shape).cobjectCoefficients (anything
np.arrayaccepts — 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
cis empty along axis 0.
lagvalnd(object[], object)
Evaluates the N-D Laguerre series at the points pts = (x, y, …) — the n-dimensional
lagval2d(object, object, object). NumPy 2.5's addition (gh-30857): pu._valnd(lagval, c, *pts), the computation NumPy
2.4 kept private as polyutils._valnd.
public NDArray lagvalnd(object[] pts, object c)
Parameters
ptsobject[]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). AnNDArray[]passes as it is.cobjectCoefficients (anything
np.arrayaccepts — 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 ispts[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
ptsis 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.
lagvander(object, int)
The pseudo-Vandermonde matrix of degree deg: V[..., i] = L_i(x) (Laguerre), by NumPy's
forward recurrence v[0] = x0 + 1; v[1] = 1 - x; v[i] = (v[i-1](2i - 1 - x) - v[i-2](i - 1)) / i (the
Python int 2*i - 1 formed first, then one array subtraction). Bit-identical to NumPy 2.4.2's
lagvander (one IL kernel pass).
public NDArray lagvander(object x, int deg)
Parameters
xobjectThe points (see polyvander(object, int): any layout; the matrix dtype is
(x + 0.0).dtype).degintThe 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.
lagvander2d(object, object, object)
The 2-D pseudo-Vandermonde matrix: column a*(deg[1] + 1) + b is L_a(x) * L_b(y) — NumPy's
_vander_nd_flat outer product of the two 1-D matrices. Bit-identical to NumPy 2.4.2's lagvander2d.
public NDArray lagvander2d(object x, object y, object deg)
Parameters
xobjectThe first coordinates (stacked with y: one shape, one promoted dtype — see polyvander2d(object, object, object)).
yobjectThe second coordinates.
degobjectThe 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 floatat 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.
lagvander3d(object, object, object, object)
The 3-D pseudo-Vandermonde matrix: column (a*(deg[1] + 1) + b)*(deg[2] + 1) + c is
L_a(x) * L_b(y) * L_c(z), the first product rounded before the second (NumPy's reduce). Bit-identical to
NumPy 2.4.2's lagvander3d.
public NDArray lagvander3d(object x, object y, object z, object deg)
Parameters
xobjectThe first coordinates (x, y, z stacked: one shape).
yobjectThe second coordinates.
zobjectThe third coordinates.
degobjectThe 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 floatat 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.
lagweight(object)
The Laguerre weight function exp(-x), computed as NumPy 2.4.2 writes it, np.exp(-x). The
negation runs in x's dtype first, so an unsigned or signed integer x wraps before the exponential
(-np.uint8(1) is 255) and a bool x is refused. An ndarray is computed in one fused pass.
public NDArray lagweight(object x)
Parameters
xobjectThe points: an NDArray of any layout and dtype, or a typed C# array (an ndarray); a Python scalar — a C#
bool, integer, BigInteger,float,doubleor Complex, negated with CPython's arithmetic (exact for an int) beforenp.expconverts it; or a NumPy scalar (Half,char,decimal). x is not converted first, so a Python list or tuple is refused by Python's unary-.
Returns
- NDArray
The weights: an array of x's shape for an ndarray x, in
np.exp's dtype for x's dtype (float16 for int8 / uint8, float32 for int16 / uint16, float64 for wider integers, x's own for a float or complex x), a 0-d array for a scalar x.
Remarks
Exceptions
- TypeError
xis a Python list or tuple (anobject[], a C# list, aValueTuple), null or a string: Python'sbad operand type for unary -: 'list'('tuple','NoneType','str'). A bool array: NumPy'sThe numpy boolean negative, the. A Python int whose negation fits neither int64 nor uint64: NumPy's object loop,-operator, is not supported, …loop of ufunc does not support argument 0 of type int which has no callable exp method. A string array:np.negative's no-loop error.- OverflowException
A decimal x whose exponential is past decimal's range (decimal has no NumPy dtype and no infinity; the house decimal
expraises).
poly2lag(object)
Converts the power series pol to a Laguerre series — Horner's scheme over the Laguerre series's own ops:
res = lagadd(lagmulx(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 poly2lag.
public NDArray poly2lag(object pol)
Parameters
polobjectThe power-series coefficients. The coefficients, LOW degree first: an NDArray (any layout), a typed C# array, a Python list or tuple (
object[], aValueTuple, 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 Laguerre 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).