Struct np.LinspaceResult
- Namespace
- NumSharp
- Assembly
- NumSharp.dll
The result of linspace(object, object, long, bool, bool, DType, int, string): NumPy's
samples-or-(samples, step) return as one type. It converts implicitly to NDArray
(the samples: NDArray y = np.linspace(a, b, 5, retstep: false);) and deconstructs into both
(var (y, step) = np.linspace(0, 1, 5, retstep: true);).
public readonly struct np.LinspaceResult : INDArrayCarrier
- Implements
- Inherited Members
Remarks
Only the object overload, the one that takes retstep, returns it; every call without
retstep binds linspace(NDArray, NDArray, long, bool, DType, int, string), which returns the
samples as an NDArray. Footgun: var r = np.linspace(..., retstep: true) is this struct, so
reach the array through samples (or deconstruct) before calling NDArray members on it.
Properties
samples
The samples, exactly as the NDArray overload returns them.
public NDArray samples { get; }
Property Value
step
NumPy's step, (stop - start) / div in the computation dtype (div is num - 1 with the endpoint,
num without): a 0-d array for scalar ends (NumPy's scalar, np.float64(0.25)), an array of the
ends' broadcast shape for array ends, and a 0-d NaN Python float when there is no step (no samples, or one
with the endpoint). Null when retstep was false.
public NDArray step { get; }
Property Value
Methods
Deconstruct(out NDArray, out NDArray)
Deconstructs NumPy's (samples, step) tuple: var (y, step) = np.linspace(0, 1, 5, retstep: true);
public void Deconstruct(out NDArray samples, out NDArray step)
Parameters
Exceptions
- InvalidOperationException
The call had
retstepfalse, so NumPy returned the samples alone (unpacking them into two names would be Python's own error).
Operators
implicit operator NDArray(LinspaceResult)
The samples: NumPy's bare-array return (retstep=False).
public static implicit operator NDArray(np.LinspaceResult result)
Parameters
resultnp.LinspaceResultThe linspace result.