Class np
- Namespace
- NumSharp
- Assembly
- NumSharp.dll
API bridge between NumSharp and Python NumPy
[SuppressMessage("ReSharper", "StaticMemberInitializerReferesToMemberBelow")]
public static class np
- Inheritance
-
np
- Inherited Members
Fields
bool
public static readonly Type @bool
Field Value
bool8
public static readonly Type bool8
Field Value
bool_
public static readonly Type bool_
Field Value
byte
public static readonly Type @byte
Field Value
char
public static readonly Type @char
Field Value
complex128
public static readonly Type complex128
Field Value
complex64
public static readonly Type complex64
Field Value
complex_
public static readonly Type complex_
Field Value
decimal
public static readonly Type @decimal
Field Value
double
public static readonly Type @double
Field Value
float32
public static readonly Type float32
Field Value
float64
public static readonly Type float64
Field Value
float_
public static readonly Type float_
Field Value
int0
public static readonly Type int0
Field Value
int16
public static readonly Type int16
Field Value
int32
public static readonly Type int32
Field Value
int64
public static readonly Type int64
Field Value
int_
public static readonly Type int_
Field Value
intp
public static readonly Type intp
Field Value
newaxis
A convenient alias for None, useful for indexing arrays.
public static readonly Slice newaxis
Field Value
Remarks
https://numpy.org/doc/stable/user/basics.indexing.html
https://stackoverflow.com/questions/42190783/what-does-three-dots-in-python-mean-when-indexing-what-looks-like-a-number
ubyte
public static readonly Type ubyte
Field Value
uint
public static readonly Type @uint
Field Value
uint0
public static readonly Type uint0
Field Value
uint16
public static readonly Type uint16
Field Value
uint32
public static readonly Type uint32
Field Value
uint64
public static readonly Type uint64
Field Value
uint8
public static readonly Type uint8
Field Value
Properties
BackendEngine
public static BackendType BackendEngine { get; set; }
Property Value
Inf
public static double Inf { get; }
Property Value
Infinity
public static double Infinity { get; }
Property Value
NAN
public static double NAN { get; }
Property Value
NINF
public static double NINF { get; }
Property Value
NaN
public static double NaN { get; }
Property Value
PINF
public static double PINF { get; }
Property Value
chars
public static Type chars { get; }
Property Value
e
public static double e { get; }
Property Value
euler_gamma
public static double euler_gamma { get; }
Property Value
inf
public static double inf { get; }
Property Value
infinity
public static double infinity { get; }
Property Value
infty
public static double infty { get; }
Property Value
nan
public static double nan { get; }
Property Value
pi
public static double pi { get; }
Property Value
random
public static NumPyRandom random { get; }
Property Value
Methods
LoadJagged(byte[])
public static Array LoadJagged(byte[] bytes)
Parameters
bytesbyte[]
Returns
LoadJagged(Stream, bool)
public static Array LoadJagged(Stream stream, bool trim = true)
Parameters
Returns
LoadJagged(string)
public static Array LoadJagged(string path)
Parameters
pathstring
Returns
LoadJagged_Npz(byte[])
public static NpzDictionary<Array> LoadJagged_Npz(byte[] bytes)
Parameters
bytesbyte[]
Returns
LoadJagged_Npz(Stream, bool)
public static NpzDictionary<Array> LoadJagged_Npz(Stream stream, bool trim = true)
Parameters
Returns
LoadJagged_Npz(string)
public static NpzDictionary<Array> LoadJagged_Npz(string path)
Parameters
pathstring
Returns
LoadMatrix(byte[])
public static Array LoadMatrix(byte[] bytes)
Parameters
bytesbyte[]
Returns
LoadMatrix(Stream)
public static Array LoadMatrix(Stream stream)
Parameters
streamStream
Returns
LoadMatrix(string)
public static Array LoadMatrix(string path)
Parameters
pathstring
Returns
LoadMatrix_Npz(byte[])
public static NpzDictionary<Array> LoadMatrix_Npz(byte[] bytes)
Parameters
bytesbyte[]
Returns
LoadMatrix_Npz(Stream)
public static NpzDictionary<Array> LoadMatrix_Npz(Stream stream)
Parameters
streamStream
Returns
LoadMatrix_Npz(string)
public static NpzDictionary<Array> LoadMatrix_Npz(string path)
Parameters
pathstring
Returns
Load_Npz<T>(byte[])
public static NpzDictionary<T> Load_Npz<T>(byte[] bytes) where T : class, ICloneable, IList, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable
Parameters
bytesbyte[]
Returns
Type Parameters
T
Load_Npz<T>(byte[], out T)
public static void Load_Npz<T>(byte[] bytes, out T value) where T : class, ICloneable, IList, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable
Parameters
bytesbyte[]valueT
Type Parameters
T
Load_Npz<T>(Stream)
public static NpzDictionary<T> Load_Npz<T>(Stream stream) where T : class, ICloneable, IList, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable
Parameters
streamStream
Returns
Type Parameters
T
Load_Npz<T>(Stream, out NpzDictionary<T>)
public static NpzDictionary<T> Load_Npz<T>(Stream stream, out NpzDictionary<T> value) where T : class, ICloneable, IList, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable
Parameters
streamStreamvalueNpzDictionary<T>
Returns
Type Parameters
T
Load_Npz<T>(Stream, out T)
public static void Load_Npz<T>(Stream stream, out T value) where T : class, ICloneable, IList, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable
Parameters
streamStreamvalueT
Type Parameters
T
Load_Npz<T>(string)
public static NpzDictionary<T> Load_Npz<T>(string path) where T : class, ICloneable, IList, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable
Parameters
pathstring
Returns
Type Parameters
T
Load_Npz<T>(string, out NpzDictionary<T>)
public static NpzDictionary<T> Load_Npz<T>(string path, out NpzDictionary<T> value) where T : class, ICloneable, IList, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable
Parameters
pathstringvalueNpzDictionary<T>
Returns
Type Parameters
T
Load_Npz<T>(string, out T)
public static void Load_Npz<T>(string path, out T value) where T : class, ICloneable, IList, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable
Parameters
pathstringvalueT
Type Parameters
T
Load<T>(byte[])
public static T Load<T>(byte[] bytes) where T : class, ICloneable, IList, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable
Parameters
bytesbyte[]
Returns
- T
Type Parameters
T
Load<T>(byte[], out T)
public static T Load<T>(byte[] bytes, out T value) where T : class, ICloneable, IList, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable
Parameters
bytesbyte[]valueT
Returns
- T
Type Parameters
T
Load<T>(Stream)
public static T Load<T>(Stream stream) where T : class, ICloneable, IList, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable
Parameters
streamStream
Returns
- T
Type Parameters
T
Load<T>(Stream, out T)
public static T Load<T>(Stream stream, out T value) where T : class, ICloneable, IList, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable
Parameters
streamStreamvalueT
Returns
- T
Type Parameters
T
Load<T>(string)
public static T Load<T>(string path) where T : class, ICloneable, IList, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable
Parameters
pathstring
Returns
- T
Type Parameters
T
Load<T>(string, out T)
public static T Load<T>(string path, out T value) where T : class, ICloneable, IList, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable
Parameters
pathstringvalueT
Returns
- T
Type Parameters
T
Save(Array)
public static byte[] Save(Array array)
Parameters
arrayArray
Returns
- byte[]
Save(Array, Stream)
public static ulong Save(Array array, Stream stream)
Parameters
Returns
Save(Array, string)
public static ulong Save(Array array, string path)
Parameters
Returns
Save_Npz(Array, CompressionLevel)
public static byte[] Save_Npz(Array array, CompressionLevel compression = CompressionLevel.Fastest)
Parameters
arrayArraycompressionCompressionLevel
Returns
- byte[]
Save_Npz(Array, Stream, CompressionLevel, bool)
public static void Save_Npz(Array array, Stream stream, CompressionLevel compression = CompressionLevel.Fastest, bool leaveOpen = false)
Parameters
arrayArraystreamStreamcompressionCompressionLevelleaveOpenbool
Save_Npz(Array, string, CompressionLevel)
public static void Save_Npz(Array array, string path, CompressionLevel compression = CompressionLevel.Fastest)
Parameters
arrayArraypathstringcompressionCompressionLevel
Save_Npz(Dictionary<string, Array>, CompressionLevel)
public static byte[] Save_Npz(Dictionary<string, Array> arrays, CompressionLevel compression = CompressionLevel.Fastest)
Parameters
arraysDictionary<string, Array>compressionCompressionLevel
Returns
- byte[]
Save_Npz(Dictionary<string, Array>, Stream, CompressionLevel, bool)
public static void Save_Npz(Dictionary<string, Array> arrays, Stream stream, CompressionLevel compression = CompressionLevel.Fastest, bool leaveOpen = false)
Parameters
arraysDictionary<string, Array>streamStreamcompressionCompressionLevelleaveOpenbool
Save_Npz(Dictionary<string, Array>, string, CompressionLevel)
public static void Save_Npz(Dictionary<string, Array> arrays, string path, CompressionLevel compression = CompressionLevel.Fastest)
Parameters
arraysDictionary<string, Array>pathstringcompressionCompressionLevel
abs(in NDArray)
Calculate the absolute value element-wise.
np.abs is a shorthand for this function.
public static NDArray abs(in NDArray a)
Parameters
aNDArrayInput value.
Returns
- NDArray
An ndarray containing the absolute value of each element in x.
Remarks
abs(in NDArray, NPTypeCode?)
Calculate the absolute value element-wise.
np.abs is a shorthand for this function.
public static NDArray abs(in NDArray a, NPTypeCode? outType)
Parameters
aNDArrayInput value.
outTypeNPTypeCode?The dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
An ndarray containing the absolute value of each element in x.
Remarks
abs(in NDArray, Type)
Calculate the absolute value element-wise.
np.abs is a shorthand for this function.
public static NDArray abs(in NDArray a, Type outType)
Parameters
aNDArrayInput value.
outTypeTypeThe dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
An ndarray containing the absolute value of each element in x.
Remarks
absolute(in NDArray)
Calculate the absolute value element-wise.
np.abs is a shorthand for this function.
public static NDArray absolute(in NDArray a)
Parameters
aNDArrayInput value.
Returns
- NDArray
An ndarray containing the absolute value of each element in x.
Remarks
absolute(in NDArray, NPTypeCode?)
Calculate the absolute value element-wise.
np.abs is a shorthand for this function.
public static NDArray absolute(in NDArray a, NPTypeCode? outType)
Parameters
aNDArrayInput value.
outTypeNPTypeCode?The dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
An ndarray containing the absolute value of each element in x.
Remarks
absolute(in NDArray, Type)
Calculate the absolute value element-wise.
np.abs is a shorthand for this function.
public static NDArray absolute(in NDArray a, Type outType)
Parameters
aNDArrayInput value.
outTypeTypeThe dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
An ndarray containing the absolute value of each element in x.
Remarks
add(in NDArray, in NDArray)
public static NDArray add(in NDArray x1, in NDArray x2)
Parameters
Returns
Remarks
all(NDArray)
Test whether all array elements along a given axis evaluate to True.
public static bool all(NDArray a)
Parameters
aNDArrayInput array or object that can be converted to an array.
Returns
- bool
A new boolean or ndarray is returned unless out is specified, in which case a reference to out is returned.
Remarks
all(NDArray, int, bool)
Test whether all array elements along a given axis evaluate to True.
public static NDArray<bool> all(NDArray nd, int axis, bool keepdims = false)
Parameters
ndNDArrayaxisintAxis or axes along which a logical AND reduction is performed. The default (axis = None) is to perform a logical OR over all the dimensions of the input array. axis may be negative, in which case it counts from the last to the first axis.
keepdimsbool
Returns
- NDArray<bool>
A new boolean or ndarray is returned unless out is specified, in which case a reference to out is returned.
Remarks
allclose(NDArray, NDArray, double, double, bool)
Returns True if two arrays are element-wise equal within a tolerance. The tolerance values are positive, typically very small numbers.The
relative difference (rtol * abs(b)) and the absolute difference
atol are added together to compare against the absolute difference
between a and b.
If either array contains one or more NaNs, False is returned.
Infs are treated as equal if they are in the same place and of the same
sign in both arrays.
public static bool allclose(NDArray a, NDArray b, double rtol = 1E-05, double atol = 1E-08, bool equal_nan = false)
Parameters
aNDArrayInput array to compare with b
bNDArrayInput array to compare with a.
rtoldoubleThe relative tolerance parameter(see Notes)
atoldoubleThe absolute tolerance parameter(see Notes)
equal_nanboolWhether to compare NaN's as equal. If True, NaN's in
awill be considered equal to NaN's inbin the output array.
Returns
amax(NDArray, int?, bool, Type)
Return the maximum of an array or maximum along an axis.
public static NDArray amax(NDArray a, int? axis = null, bool keepdims = false, Type dtype = null)
Parameters
aNDArrayaxisint?Axis or axes along which to operate.
keepdimsboolIf this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.
dtypeTypethe type expected as a return, null will remain the same dtype.
Returns
- NDArray
Maximum of a. If axis is None, the result is a scalar value. If axis is given, the result is an array of dimension a.ndim - 1.
Remarks
amax<T>(NDArray)
Return the maximum of an array or maximum along an axis.
public static T amax<T>(NDArray a) where T : unmanaged
Parameters
aNDArray
Returns
- T
Maximum of a. If axis is None, the result is a scalar value. If axis is given, the result is an array of dimension a.ndim - 1.
Type Parameters
Tthe type expected as a return, cast is performed if necessary.
Remarks
amin(in NDArray, int?, bool, Type)
Return the minimum of an array or minimum along an axis.
public static NDArray amin(in NDArray a, int? axis = null, bool keepdims = false, Type dtype = null)
Parameters
aNDArrayInput data.
axisint?Axis or axes along which to operate.
keepdimsboolIf this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.
dtypeTypethe type expected as a return, null will remain the same dtype.
Returns
- NDArray
Minimum of a. If axis is None, the result is a scalar value. If axis is given, the result is an array of dimension a.ndim - 1.
Remarks
amin<T>(in NDArray)
Return the minimum of an array or minimum along an axis.
public static T amin<T>(in NDArray a) where T : unmanaged
Parameters
aNDArrayInput data.
Returns
- T
Minimum of a. If axis is None, the result is a scalar value. If axis is given, the result is an array of dimension a.ndim - 1.
Type Parameters
Tthe type expected as a return, cast is performed if necessary.
Remarks
any(NDArray)
Test whether any array element along a given axis evaluates to True.
public static bool any(NDArray a)
Parameters
aNDArrayInput array or object that can be converted to an array.
Returns
- bool
A new boolean or ndarray is returned unless out is specified, in which case a reference to out is returned.
Remarks
any(NDArray, int, bool)
Test whether any array element along a given axis evaluates to True.
public static NDArray<bool> any(NDArray nd, int axis, bool keepdims)
Parameters
ndNDArrayaxisintAxis or axes along which a logical OR reduction is performed. The default (axis = None) is to perform a logical OR over all the dimensions of the input array. axis may be negative, in which case it counts from the last to the first axis.
keepdimsbool
Returns
- NDArray<bool>
A new boolean or ndarray is returned unless out is specified, in which case a reference to out is returned.
Remarks
arange(double)
Return evenly spaced values within a given interval.
Values are generated within the half-open interval [start, stop) (in other words, the interval including start but excluding stop). For integer arguments the function is equivalent to the Python built-in range function, but returns an ndarray rather than a list.
When using a non-integer step, such as 0.1, the results will often not be consistent. It is better to use numpy.linspace for these cases.
public static NDArray arange(double stop)
Parameters
stopdoubleEnd of interval. The interval does not include this value, except in some cases where step is not an integer and floating point round-off affects the length of out.
Returns
- NDArray
Array of evenly spaced values.
For floating point arguments, the length of the result is ceil((stop - start)/step). Because of floating point overflow, this rule may result in the last element of out being greater than stop.
arange(double, double, double)
Return evenly spaced values within a given interval.
Values are generated within the half-open interval [start, stop) (in other words, the interval including start but excluding stop). For integer arguments the function is equivalent to the Python built-in range function, but returns an ndarray rather than a list.
When using a non-integer step, such as 0.1, the results will often not be consistent. It is better to use numpy.linspace for these cases.
public static NDArray arange(double start, double stop, double step = 1)
Parameters
startdoubleStart of interval. The interval includes this value. The default start value is 0.
stopdoubleEnd of interval. The interval does not include this value, except in some cases where step is not an integer and floating point round-off affects the length of out.
stepdoubleSpacing between values. For any output out, this is the distance between two adjacent values, out[i+1] - out[i]. The default step size is 1. If step is specified as a position argument, start must also be given.
Returns
- NDArray
Array of evenly spaced values.
For floating point arguments, the length of the result is ceil((stop - start)/step). Because of floating point overflow, this rule may result in the last element of out being greater than stop.
arange(int)
Return evenly spaced values within a given interval.
Values are generated within the half-open interval [start, stop) (in other words, the interval including start but excluding stop). For integer arguments the function is equivalent to the Python built-in range function, but returns an ndarray rather than a list.
When using a non-integer step, such as 0.1, the results will often not be consistent. It is better to use numpy.linspace for these cases.
public static NDArray arange(int stop)
Parameters
stopintEnd of interval. The interval does not include this value, except in some cases where step is not an integer and floating point round-off affects the length of out.
Returns
- NDArray
Array of evenly spaced values.
For floating point arguments, the length of the result is ceil((stop - start)/step). Because of floating point overflow, this rule may result in the last element of out being greater than stop.
arange(int, int, int)
Return evenly spaced values within a given interval.
Values are generated within the half-open interval [start, stop) (in other words, the interval including start but excluding stop). For integer arguments the function is equivalent to the Python built-in range function, but returns an ndarray rather than a list.
When using a non-integer step, such as 0.1, the results will often not be consistent. It is better to use numpy.linspace for these cases.
public static NDArray arange(int start, int stop, int step = 1)
Parameters
startintStart of interval. The interval includes this value. The default start value is 0.
stopintEnd of interval. The interval does not include this value, except in some cases where step is not an integer and floating point round-off affects the length of out.
stepintSpacing between values. For any output out, this is the distance between two adjacent values, out[i+1] - out[i]. The default step size is 1. If step is specified as a position argument, start must also be given.
Returns
- NDArray
Array of evenly spaced values.
For floating point arguments, the length of the result is ceil((stop - start)/step). Because of floating point overflow, this rule may result in the last element of out being greater than stop.
arange(float)
Return evenly spaced values within a given interval.
Values are generated within the half-open interval [start, stop) (in other words, the interval including start but excluding stop). For integer arguments the function is equivalent to the Python built-in range function, but returns an ndarray rather than a list.
When using a non-integer step, such as 0.1, the results will often not be consistent. It is better to use numpy.linspace for these cases.
public static NDArray arange(float stop)
Parameters
stopfloatEnd of interval. The interval does not include this value, except in some cases where step is not an integer and floating point round-off affects the length of out.
Returns
- NDArray
Array of evenly spaced values.
For floating point arguments, the length of the result is ceil((stop - start)/step). Because of floating point overflow, this rule may result in the last element of out being greater than stop.
arange(float, float, float)
Return evenly spaced values within a given interval.
Values are generated within the half-open interval [start, stop) (in other words, the interval including start but excluding stop). For integer arguments the function is equivalent to the Python built-in range function, but returns an ndarray rather than a list.
When using a non-integer step, such as 0.1, the results will often not be consistent. It is better to use numpy.linspace for these cases.
public static NDArray arange(float start, float stop, float step = 1)
Parameters
startfloatStart of interval. The interval includes this value. The default start value is 0.
stopfloatEnd of interval. The interval does not include this value, except in some cases where step is not an integer and floating point round-off affects the length of out.
stepfloatSpacing between values. For any output out, this is the distance between two adjacent values, out[i+1] - out[i]. The default step size is 1. If step is specified as a position argument, start must also be given.
Returns
- NDArray
Array of evenly spaced values.
For floating point arguments, the length of the result is ceil((stop - start)/step). Because of floating point overflow, this rule may result in the last element of out being greater than stop.
arccos(in NDArray, NPTypeCode?)
Trigonometric inverse cosine, element-wise.
The inverse of cos so that, if y = cos(x), then x = arccos(y).
public static NDArray arccos(in NDArray x, NPTypeCode? outType = null)
Parameters
xNDArrayInput array.
outTypeNPTypeCode?The dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
The angle of the ray intersecting the unit circle at the given x-coordinate in radians [0, pi]. This is a scalar if x is a scalar.
Remarks
arccos(in NDArray, Type)
Trigonometric inverse cosine, element-wise.
The inverse of cos so that, if y = cos(x), then x = arccos(y).
public static NDArray arccos(in NDArray x, Type outType)
Parameters
xNDArrayInput array.
outTypeTypeThe dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
The angle of the ray intersecting the unit circle at the given x-coordinate in radians [0, pi]. This is a scalar if x is a scalar.
Remarks
arcsin(in NDArray, NPTypeCode?)
Inverse sine, element-wise.
The convention is to return the angle z whose real part lies in [-pi/2, pi/2].
public static NDArray arcsin(in NDArray x, NPTypeCode? outType = null)
Parameters
xNDArrayInput array.
outTypeNPTypeCode?The dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
The inverse sine of each element in x, in radians and in the closed interval [-pi/2, pi/2]. This is a scalar if x is a scalar.
Remarks
arcsin(in NDArray, Type)
Inverse sine, element-wise.
The convention is to return the angle z whose real part lies in [-pi/2, pi/2].
public static NDArray arcsin(in NDArray x, Type outType)
Parameters
xNDArrayInput array.
outTypeTypeThe dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
The inverse sine of each element in x, in radians and in the closed interval [-pi/2, pi/2]. This is a scalar if x is a scalar.
Remarks
arctan(in NDArray, NPTypeCode?)
Compute trigonometric inverse tangent, element-wise.
The inverse of tan, so that if y = tan(x) then x = arctan(y).
public static NDArray arctan(in NDArray x, NPTypeCode? outType = null)
Parameters
xNDArrayInput array.
outTypeNPTypeCode?The dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
Return has the same shape as x. Its real part is in [-pi/2, pi/2] (arctan(+/-inf) returns +/-pi/2). This is a scalar if x is a scalar.
Remarks
arctan(in NDArray, Type)
Compute trigonometric inverse tangent, element-wise.
The inverse of tan, so that if y = tan(x) then x = arctan(y).
public static NDArray arctan(in NDArray x, Type outType)
Parameters
xNDArrayInput array.
outTypeTypeThe dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
Return has the same shape as x. Its real part is in [-pi/2, pi/2] (arctan(+/-inf) returns +/-pi/2). This is a scalar if x is a scalar.
Remarks
arctan2(in NDArray, in NDArray, NPTypeCode?)
Compute Element-wise arc tangent of x1/x2 choosing the quadrant correctly.
By IEEE convention, this function is defined for x2 = +/-0 and for either or both of x1 and x2 = +/-inf
public static NDArray arctan2(in NDArray y, in NDArray x, NPTypeCode? outType = null)
Parameters
yNDArrayxNDArrayInput array y-coordinates.
outTypeNPTypeCode?The dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
The Array of angles in radians, in the range [-pi, pi]. This is a scalar if both x1 and x2 are scalars.
Remarks
arctan2(in NDArray, in NDArray, Type)
Compute Element-wise arc tangent of x1/x2 choosing the quadrant correctly.
By IEEE convention, this function is defined for x2 = +/-0 and for either or both of x1 and x2 = +/-inf
public static NDArray arctan2(in NDArray y, in NDArray x, Type outType)
Parameters
yNDArrayxNDArrayInput array y-coordinates.
outTypeTypeThe dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
The Array of angles in radians, in the range [-pi, pi]. This is a scalar if both x1 and x2 are scalars.
Remarks
are_broadcastable(NDArray, NDArray)
Tests if these two two arrays are broadcastable against each other.
public static bool are_broadcastable(NDArray lhs, NDArray rhs)
Parameters
Returns
- bool
True if these can be broadcasted against each other.
Remarks
are_broadcastable(params NDArray[])
Tests if these two two arrays are broadcastable against each other.
public static bool are_broadcastable(params NDArray[] ndArrays)
Parameters
ndArraysNDArray[]The arrays to test for broadcasting.
Returns
- bool
True if these can be broadcasted against each other.
Remarks
are_broadcastable(params Shape[])
Tests if these two two arrays are broadcastable against each other.
public static bool are_broadcastable(params Shape[] shapes)
Parameters
shapesShape[]The shapes to test for broadcasting.
Returns
- bool
True if these can be broadcasted against each other.
Remarks
are_broadcastable(params int[][])
Tests if these two two arrays are broadcastable against each other.
public static bool are_broadcastable(params int[][] shapes)
Parameters
shapesint[][]The shapes to test for broadcasting.
Returns
- bool
True if these can be broadcasted against each other.
Remarks
argmax(NDArray)
Returns the index of the maximum value.
public static int argmax(NDArray a)
Parameters
aNDArrayInput array.
Returns
- int
Array of indices into the array. It has the same shape as a.shape with the dimension along axis removed.
Remarks
argmax(NDArray, int)
Returns the indices of the maximum values along an axis.
public static NDArray argmax(NDArray a, int axis)
Parameters
aNDArrayInput array.
axisintBy default, the index is into the flattened array, otherwise along the specified axis.
Returns
- NDArray
Array of indices into the array. It has the same shape as a.shape with the dimension along axis removed.
Remarks
argmin(NDArray)
Returns the index of the minimum value.
public static int argmin(NDArray a)
Parameters
aNDArrayInput array.
Returns
- int
Array of indices into the array. It has the same shape as a.shape with the dimension along axis removed.
Remarks
argmin(NDArray, int)
Returns the indices of the minimum values along an axis.
public static NDArray argmin(NDArray a, int axis)
Parameters
aNDArrayInput array.
axisintBy default, the index is into the flattened array, otherwise along the specified axis.
Returns
- NDArray
Array of indices into the array. It has the same shape as a.shape with the dimension along axis removed.
Remarks
argsort<T>(NDArray, int)
Returns the indices that would sort an array.
Perform an indirect sort along the given axis using the algorithm specified by the kind keyword.It returns an array of indices of the same shape as a that index data along the given axis in sorted order.
public static NDArray argsort<T>(NDArray nd, int axis = -1)
Parameters
Returns
Type Parameters
T
around(in NDArray, int, NPTypeCode?)
Evenly round to the given number of decimals.
public static NDArray around(in NDArray x, int decimals, NPTypeCode? outType = null)
Parameters
xNDArrayInput array
decimalsintNumber of decimal places to round to
outTypeNPTypeCode?The dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
An array of the same type as a, containing the rounded values. Unless out was specified, a new array is created. A reference to the result is returned. The real and imaginary parts of complex numbers are rounded separately.The result of rounding a float is a float.
Remarks
around(in NDArray, int, Type)
Evenly round to the given number of decimals.
public static NDArray around(in NDArray x, int decimals, Type outType)
Parameters
xNDArrayInput array
decimalsintNumber of decimal places to round to
outTypeTypeThe dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
An array of the same type as a, containing the rounded values. Unless out was specified, a new array is created. A reference to the result is returned. The real and imaginary parts of complex numbers are rounded separately.The result of rounding a float is a float.
Remarks
around(in NDArray, NPTypeCode?)
Evenly round to the given number of decimals.
public static NDArray around(in NDArray x, NPTypeCode? outType = null)
Parameters
xNDArrayInput array
outTypeNPTypeCode?The dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
An array of the same type as a, containing the rounded values. Unless out was specified, a new array is created. A reference to the result is returned. The real and imaginary parts of complex numbers are rounded separately.The result of rounding a float is a float.
Remarks
around(in NDArray, Type)
Evenly round to the given number of decimals.
public static NDArray around(in NDArray x, Type outType)
Parameters
xNDArrayInput array
outTypeTypeThe dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
An array of the same type as a, containing the rounded values. Unless out was specified, a new array is created. A reference to the result is returned. The real and imaginary parts of complex numbers are rounded separately.The result of rounding a float is a float.
Remarks
array(NDArray, bool)
Wraps given nd in an alias. If copy is true then returns a clone.
public static NDArray array(NDArray nd, bool copy = false)
Parameters
Returns
array(Array, Type, int, bool, char)
Creates an NDArray from an array with an unknown size or dtype.
[SuppressMessage("ReSharper", "InvalidXmlDocComment")]
public static NDArray array(Array array, Type dtype = null, int ndmin = 1, bool copy = true, char order = 'C')
Parameters
arrayArraydtypeTypendminintSpecifies the minimum number of dimensions that the resulting array should have. Ones will be pre-pended to the shape as needed to meet this requirement.
copyboolAlways copies if the array is larger than 1-d.
ordercharNot used.
Returns
Remarks
array(string)
public static NDArray array(string chars)
Parameters
charsstring
Returns
array(string[])
Create a vector ndarray of type <xref href="System.String" data-throw-if-not-resolved="false"></xref>.
Encode string array. format: [numOfRow lenOfRow1 lenOfRow2 contents] sample: [2 2 4 aacccc]
public static NDArray array(string[] strArray)
Parameters
strArraystring[]
Returns
array_equal(NDArray, NDArray)
True if two arrays have the same shape and elements, False otherwise.
public static bool array_equal(NDArray a, NDArray b)
Parameters
Returns
- bool
Returns True if the arrays are equal.
Remarks
array<T>(IEnumerable<T>)
Creates a Vector NDArray from given data.
public static NDArray array<T>(IEnumerable<T> data) where T : unmanaged
Parameters
dataIEnumerable<T>The enumeration of data to create NDArray from.
Returns
Type Parameters
TThe type of given array, must be compliant to numpy's supported dtypes.
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.array.html
Always performs a copy.
array<T>(IEnumerable<T>, int)
Creates a Vector NDArray from given data.
public static NDArray array<T>(IEnumerable<T> data, int size) where T : unmanaged
Parameters
dataIEnumerable<T>The enumeration of data to create NDArray from.
sizeint
Returns
Type Parameters
TThe type of given array, must be compliant to numpy's supported dtypes.
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.array.html
Always performs a copy.
size can be used to limit the amount of items to read form data. Reading stops on either size or data ends.
array<T>(T[,,,,,,,,,,,,,,,], bool)
Creates an NDArray from given data.
public static NDArray array<T>(T[,,,,,,,,,,,,,,,] data, bool copy = true) where T : unmanaged
Parameters
dataT[,,,,,,,,,,,,,,,]The array to create NDArray from.
copyboolIf true then the array will be copied to a newly allocated memory.
If false then the array will be pinned by calling Alloc(object).
Returns
Type Parameters
TThe type of given array, must be compliant to numpy's supported dtypes.
Remarks
array<T>(T[,,,,,,,,,,,,,,], bool)
Creates an NDArray from given data.
public static NDArray array<T>(T[,,,,,,,,,,,,,,] data, bool copy = true) where T : unmanaged
Parameters
dataT[,,,,,,,,,,,,,,]The array to create NDArray from.
copyboolIf true then the array will be copied to a newly allocated memory.
If false then the array will be pinned by calling Alloc(object).
Returns
Type Parameters
TThe type of given array, must be compliant to numpy's supported dtypes.
Remarks
array<T>(T[,,,,,,,,,,,,,], bool)
Creates an NDArray from given data.
public static NDArray array<T>(T[,,,,,,,,,,,,,] data, bool copy = true) where T : unmanaged
Parameters
dataT[,,,,,,,,,,,,,]The array to create NDArray from.
copyboolIf true then the array will be copied to a newly allocated memory.
If false then the array will be pinned by calling Alloc(object).
Returns
Type Parameters
TThe type of given array, must be compliant to numpy's supported dtypes.
Remarks
array<T>(T[,,,,,,,,,,,,], bool)
Creates an NDArray from given data.
public static NDArray array<T>(T[,,,,,,,,,,,,] data, bool copy = true) where T : unmanaged
Parameters
dataT[,,,,,,,,,,,,]The array to create NDArray from.
copyboolIf true then the array will be copied to a newly allocated memory.
If false then the array will be pinned by calling Alloc(object).
Returns
Type Parameters
TThe type of given array, must be compliant to numpy's supported dtypes.
Remarks
array<T>(T[,,,,,,,,,,,], bool)
Creates an NDArray from given data.
public static NDArray array<T>(T[,,,,,,,,,,,] data, bool copy = true) where T : unmanaged
Parameters
dataT[,,,,,,,,,,,]The array to create NDArray from.
copyboolIf true then the array will be copied to a newly allocated memory.
If false then the array will be pinned by calling Alloc(object).
Returns
Type Parameters
TThe type of given array, must be compliant to numpy's supported dtypes.
Remarks
array<T>(T[,,,,,,,,,,], bool)
Creates an NDArray from given data.
public static NDArray array<T>(T[,,,,,,,,,,] data, bool copy = true) where T : unmanaged
Parameters
dataT[,,,,,,,,,,]The array to create NDArray from.
copyboolIf true then the array will be copied to a newly allocated memory.
If false then the array will be pinned by calling Alloc(object).
Returns
Type Parameters
TThe type of given array, must be compliant to numpy's supported dtypes.
Remarks
array<T>(T[,,,,,,,,,], bool)
Creates an NDArray from given data.
public static NDArray array<T>(T[,,,,,,,,,] data, bool copy = true) where T : unmanaged
Parameters
dataT[,,,,,,,,,]The array to create NDArray from.
copyboolIf true then the array will be copied to a newly allocated memory.
If false then the array will be pinned by calling Alloc(object).
Returns
Type Parameters
TThe type of given array, must be compliant to numpy's supported dtypes.
Remarks
array<T>(T[,,,,,,,,], bool)
Creates an NDArray from given data.
public static NDArray array<T>(T[,,,,,,,,] data, bool copy = true) where T : unmanaged
Parameters
dataT[,,,,,,,,]The array to create NDArray from.
copyboolIf true then the array will be copied to a newly allocated memory.
If false then the array will be pinned by calling Alloc(object).
Returns
Type Parameters
TThe type of given array, must be compliant to numpy's supported dtypes.
Remarks
array<T>(T[,,,,,,,], bool)
Creates an NDArray from given data.
public static NDArray array<T>(T[,,,,,,,] data, bool copy = true) where T : unmanaged
Parameters
dataT[,,,,,,,]The array to create NDArray from.
copyboolIf true then the array will be copied to a newly allocated memory.
If false then the array will be pinned by calling Alloc(object).
Returns
Type Parameters
TThe type of given array, must be compliant to numpy's supported dtypes.
Remarks
array<T>(T[,,,,,,], bool)
Creates an NDArray from given data.
public static NDArray array<T>(T[,,,,,,] data, bool copy = true) where T : unmanaged
Parameters
dataT[,,,,,,]The array to create NDArray from.
copyboolIf true then the array will be copied to a newly allocated memory.
If false then the array will be pinned by calling Alloc(object).
Returns
Type Parameters
TThe type of given array, must be compliant to numpy's supported dtypes.
Remarks
array<T>(T[,,,,,], bool)
Creates an NDArray from given data.
public static NDArray array<T>(T[,,,,,] data, bool copy = true) where T : unmanaged
Parameters
dataT[,,,,,]The array to create NDArray from.
copyboolIf true then the array will be copied to a newly allocated memory.
If false then the array will be pinned by calling Alloc(object).
Returns
Type Parameters
TThe type of given array, must be compliant to numpy's supported dtypes.
Remarks
array<T>(T[,,,,], bool)
Creates an NDArray from given data.
public static NDArray array<T>(T[,,,,] data, bool copy = true) where T : unmanaged
Parameters
dataT[,,,,]The array to create NDArray from.
copyboolIf true then the array will be copied to a newly allocated memory.
If false then the array will be pinned by calling Alloc(object).
Returns
Type Parameters
TThe type of given array, must be compliant to numpy's supported dtypes.
Remarks
array<T>(T[,,,], bool)
Creates an NDArray from given data.
public static NDArray array<T>(T[,,,] data, bool copy = true) where T : unmanaged
Parameters
dataT[,,,]The array to create NDArray from.
copyboolIf true then the array will be copied to a newly allocated memory.
If false then the array will be pinned by calling Alloc(object).
Returns
Type Parameters
TThe type of given array, must be compliant to numpy's supported dtypes.
Remarks
array<T>(T[,,], bool)
Creates an NDArray from given data.
public static NDArray array<T>(T[,,] data, bool copy = true) where T : unmanaged
Parameters
dataT[,,]The array to create NDArray from.
copyboolIf true then the array will be copied to a newly allocated memory.
If false then the array will be pinned by calling Alloc(object).
Returns
Type Parameters
TThe type of given array, must be compliant to numpy's supported dtypes.
Remarks
array<T>(T[,], bool)
Creates an NDArray from given data.
public static NDArray array<T>(T[,] data, bool copy = true) where T : unmanaged
Parameters
dataT[,]The array to create NDArray from.
copyboolIf true then the array will be copied to a newly allocated memory.
If false then the array will be pinned by calling Alloc(object).
Returns
Type Parameters
TThe type of given array, must be compliant to numpy's supported dtypes.
Remarks
array<T>(params T[])
Creates a Vector NDArray from given data.
public static NDArray array<T>(params T[] data) where T : unmanaged
Parameters
dataT[]The array to create NDArray from.
Returns
Type Parameters
TThe type of given array, must be compliant to numpy's supported dtypes.
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.array.html
Always performs a copy.
array<T>(T[], bool)
Creates an NDArray from given data.
public static NDArray array<T>(T[] data, bool copy) where T : unmanaged
Parameters
dataT[]The array to create NDArray from.
copyboolIf true then the array will be copied to a newly allocated memory.
If false then the array will be pinned by calling Alloc(object).
Returns
Type Parameters
TThe type of given array, must be compliant to numpy's supported dtypes.
Remarks
array<T>(T[][])
Creates an NDArray from given data.
[SuppressMessage("ReSharper", "SuggestVarOrType_SimpleTypes")]
[SuppressMessage("ReSharper", "SuggestVarOrType_Elsewhere")]
public static NDArray array<T>(T[][] data) where T : unmanaged
Parameters
dataT[][]The array to create NDArray from. Shape is taken from the first item of each array/nested array.
Returns
Type Parameters
TThe type of given array, must be compliant to numpy's supported dtypes.
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.array.html
Always performs a copy.
array<T>(T[][][])
Creates an NDArray from given data.
[SuppressMessage("ReSharper", "SuggestVarOrType_SimpleTypes")]
[SuppressMessage("ReSharper", "SuggestVarOrType_Elsewhere")]
public static NDArray array<T>(T[][][] data) where T : unmanaged
Parameters
dataT[][][]The array to create NDArray from. Shape is taken from the first item of each array/nested array.
Returns
Type Parameters
TThe type of given array, must be compliant to numpy's supported dtypes.
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.array.html
Always performs a copy.
array<T>(T[][][][])
Creates an NDArray from given data.
[SuppressMessage("ReSharper", "SuggestVarOrType_SimpleTypes")]
[SuppressMessage("ReSharper", "SuggestVarOrType_Elsewhere")]
public static NDArray array<T>(T[][][][] data) where T : unmanaged
Parameters
dataT[][][][]The array to create NDArray from. Shape is taken from the first item of each array/nested array.
Returns
Type Parameters
TThe type of given array, must be compliant to numpy's supported dtypes.
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.array.html
Always performs a copy.
array<T>(T[][][][][])
Creates an NDArray from given data.
[SuppressMessage("ReSharper", "SuggestVarOrType_SimpleTypes")]
[SuppressMessage("ReSharper", "SuggestVarOrType_Elsewhere")]
public static NDArray array<T>(T[][][][][] data) where T : unmanaged
Parameters
dataT[][][][][]The array to create NDArray from. Shape is taken from the first item of each array/nested array.
Returns
Type Parameters
TThe type of given array, must be compliant to numpy's supported dtypes.
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.array.html
Always performs a copy.
asanyarray(in object, Type)
Convert the input to an ndarray, but pass ndarray subclasses through.
public static NDArray asanyarray(in object a, Type dtype = null)
Parameters
aobjectInput data, in any form that can be converted to an array. This includes scalars, lists, lists of tuples, tuples, tuples of tuples, tuples of lists, and ndarrays.
dtypeTypeBy default, the data-type is inferred from the input data.
Returns
- NDArray
Array interpretation of a. If a is an ndarray or a subclass of ndarray, it is returned as-is and no copy is performed.
Remarks
asarray(string)
public static NDArray asarray(string data)
Parameters
datastring
Returns
asarray(string[], int)
public static NDArray asarray(string[] data, int ndim = 1)
Parameters
Returns
asarray<T>(T)
public static NDArray asarray<T>(T data) where T : struct
Parameters
dataT
Returns
Type Parameters
T
asarray<T>(T[], int)
public static NDArray asarray<T>(T[] data, int ndim = 1) where T : struct
Parameters
dataT[]ndimint
Returns
Type Parameters
T
asscalar(NDArray)
Convert an array of size 1 to its scalar equivalent.
public static ValueType asscalar(NDArray nd)
Parameters
ndNDArrayInput NDArray of size 1.
Returns
Remarks
asscalar(Array)
Convert an array of size 1 to its scalar equivalent.
public static ValueType asscalar(Array arr)
Parameters
arrArrayInput array of size 1.
Returns
Remarks
asscalar<T>(ArraySlice<T>)
Convert an array of size 1 to its scalar equivalent.
public static T asscalar<T>(ArraySlice<T> arr) where T : unmanaged
Parameters
arrArraySlice<T>Input array of size 1.
Returns
- T
Type Parameters
T
Remarks
asscalar<T>(IArraySlice)
Convert an array of size 1 to its scalar equivalent.
public static T asscalar<T>(IArraySlice arr) where T : unmanaged
Parameters
arrIArraySliceInput array of size 1.
Returns
- T
Type Parameters
T
Remarks
asscalar<T>(NDArray)
Convert an array of size 1 to its scalar equivalent.
public static T asscalar<T>(NDArray nd) where T : unmanaged
Parameters
ndNDArrayInput NDArray of size 1.
Returns
- T
Type Parameters
T
Remarks
asscalar<T>(Array)
Convert an array of size 1 to its scalar equivalent.
public static T asscalar<T>(Array arr)
Parameters
arrArrayInput array of size 1.
Returns
- T
Type Parameters
T
Remarks
atleast_1d(NDArray)
Convert inputs to arrays with at least one dimension. Scalar inputs are converted to 1-dimensional arrays, whilst higher-dimensional inputs are preserved.
public static NDArray atleast_1d(NDArray arr)
Parameters
arrNDArray
Returns
- NDArray
An array, or list of arrays, each with a.ndim >= 1. Copies are made only if necessary.
Remarks
atleast_1d(params NDArray[])
Convert inputs to arrays with at least one dimension. Scalar inputs are converted to 1-dimensional arrays, whilst higher-dimensional inputs are preserved.
public static NDArray[] atleast_1d(params NDArray[] arys)
Parameters
arysNDArray[]One or more input arrays.
Returns
- NDArray[]
An array, or list of arrays, each with a.ndim >= 1. Copies are made only if necessary.
Remarks
atleast_1d(object)
Convert inputs to arrays with at least one dimension. Scalar inputs are converted to 1-dimensional arrays, whilst higher-dimensional inputs are preserved.
public static NDArray atleast_1d(object arys)
Parameters
arysobjectOne or more input arrays.
Returns
- NDArray
An array, or list of arrays, each with a.ndim >= 1. Copies are made only if necessary.
Remarks
atleast_1d(params object[])
Convert inputs to arrays with at least one dimension. Scalar inputs are converted to 1-dimensional arrays, whilst higher-dimensional inputs are preserved.
public static NDArray[] atleast_1d(params object[] arys)
Parameters
arysobject[]One or more input arrays.
Returns
- NDArray[]
An array, or list of arrays, each with a.ndim >= 1. Copies are made only if necessary.
Remarks
atleast_2d(NDArray)
View inputs as arrays with at least two dimensions.
public static NDArray atleast_2d(NDArray arr)
Parameters
arrNDArrayOne or more array-like sequences. Non-array inputs are converted to arrays. Arrays that already have two or more dimensions are preserved.
Returns
- NDArray
An array, or list of arrays, each with a.ndim >= 2. Copies are avoided where possible, and views with two or more dimensions are returned.
Remarks
atleast_2d(params NDArray[])
View inputs as arrays with at least two dimensions.
public static NDArray[] atleast_2d(params NDArray[] arys)
Parameters
arysNDArray[]One or more array-like sequences. Non-array inputs are converted to arrays. Arrays that already have two or more dimensions are preserved.
Returns
- NDArray[]
An array, or list of arrays, each with a.ndim >= 2. Copies are avoided where possible, and views with two or more dimensions are returned.
Remarks
atleast_2d(object)
View inputs as arrays with at least two dimensions.
public static NDArray atleast_2d(object arys)
Parameters
arysobjectOne or more array-like sequences. Non-array inputs are converted to arrays. Arrays that already have two or more dimensions are preserved.
Returns
- NDArray
An array, or list of arrays, each with a.ndim >= 2. Copies are avoided where possible, and views with two or more dimensions are returned.
Remarks
atleast_2d(params object[])
View inputs as arrays with at least two dimensions.
public static NDArray[] atleast_2d(params object[] arys)
Parameters
arysobject[]One or more array-like sequences. Non-array inputs are converted to arrays. Arrays that already have two or more dimensions are preserved.
Returns
- NDArray[]
An array, or list of arrays, each with a.ndim >= 2. Copies are avoided where possible, and views with two or more dimensions are returned.
Remarks
atleast_3d(NDArray)
View inputs as arrays with at least three dimensions.
public static NDArray atleast_3d(NDArray arr)
Parameters
arrNDArray
Returns
- NDArray
An array, or list of arrays, each with a.ndim >= 3. Copies are avoided where possible, and views with three or more dimensions are returned. For example, a 1-D array of shape (N,) becomes a view of shape (1, N, 1), and a 2-D array of shape (M, N) becomes a view of shape (M, N, 1).
Remarks
atleast_3d(params NDArray[])
View inputs as arrays with at least three dimensions.
public static NDArray[] atleast_3d(params NDArray[] arys)
Parameters
arysNDArray[]One or more array-like sequences. Non-array inputs are converted to arrays. Arrays that already have three or more dimensions are preserved.
Returns
- NDArray[]
An array, or list of arrays, each with a.ndim >= 3. Copies are avoided where possible, and views with three or more dimensions are returned. For example, a 1-D array of shape (N,) becomes a view of shape (1, N, 1), and a 2-D array of shape (M, N) becomes a view of shape (M, N, 1).
Remarks
atleast_3d(object)
View inputs as arrays with at least three dimensions.
public static NDArray atleast_3d(object arys)
Parameters
arysobjectOne or more array-like sequences. Non-array inputs are converted to arrays. Arrays that already have three or more dimensions are preserved.
Returns
- NDArray
An array, or list of arrays, each with a.ndim >= 3. Copies are avoided where possible, and views with three or more dimensions are returned. For example, a 1-D array of shape (N,) becomes a view of shape (1, N, 1), and a 2-D array of shape (M, N) becomes a view of shape (M, N, 1).
Remarks
atleast_3d(params object[])
View inputs as arrays with at least three dimensions.
public static NDArray[] atleast_3d(params object[] arys)
Parameters
arysobject[]One or more array-like sequences. Non-array inputs are converted to arrays. Arrays that already have three or more dimensions are preserved.
Returns
- NDArray[]
An array, or list of arrays, each with a.ndim >= 3. Copies are avoided where possible, and views with three or more dimensions are returned. For example, a 1-D array of shape (N,) becomes a view of shape (1, N, 1), and a 2-D array of shape (M, N) becomes a view of shape (M, N, 1).
Remarks
broadcast(NDArray, NDArray)
Produce an object that mimics broadcasting.
public static np.Broadcast broadcast(NDArray nd1, NDArray nd2)
Parameters
Returns
- np.Broadcast
Broadcast the input parameters against one another, and return an object that encapsulates the result. Amongst others, it has shape and nd properties, and may be used as an iterator.
Remarks
broadcast_arrays(NDArray, NDArray)
Broadcast two arrays against each other.
public static (NDArray Lhs, NDArray Rhs) broadcast_arrays(NDArray lhs, NDArray rhs)
Parameters
Returns
- (NDArray Lhs, NDArray Rhs)
These arrays are views on the original arrays. They are typically not contiguous. Furthermore, more than one element of a broadcasted array may refer to a single memory location. If you need to write to the arrays, make copies first.
Remarks
broadcast_arrays(params NDArray[])
Broadcast any number of arrays against each other.
public static NDArray[] broadcast_arrays(params NDArray[] ndArrays)
Parameters
ndArraysNDArray[]The arrays to broadcast.
Returns
- NDArray[]
These arrays are views on the original arrays. They are typically not contiguous. Furthermore, more than one element of a broadcasted array may refer to a single memory location. If you need to write to the arrays, make copies first.
Remarks
broadcast_to(UnmanagedStorage, UnmanagedStorage)
Broadcast an array to a new shape.
public static NDArray broadcast_to(UnmanagedStorage from, UnmanagedStorage against)
Parameters
fromUnmanagedStorageThe UnmanagedStorage to broadcast.
againstUnmanagedStorageThe shape to broadcast against.
Returns
- NDArray
These arrays are views on the original arrays. They are typically not contiguous. Furthermore, more than one element of a broadcasted array may refer to a single memory location. If you need to write to the arrays, make copies first.
Remarks
broadcast_to(UnmanagedStorage, NDArray)
Broadcast an array to a new shape.
public static NDArray broadcast_to(UnmanagedStorage from, NDArray against)
Parameters
fromUnmanagedStorageThe UnmanagedStorage to broadcast.
againstNDArrayThe shape to broadcast against.
Returns
- NDArray
These arrays are views on the original arrays. They are typically not contiguous. Furthermore, more than one element of a broadcasted array may refer to a single memory location. If you need to write to the arrays, make copies first.
Remarks
broadcast_to(UnmanagedStorage, Shape)
Broadcast an array to a new shape.
public static NDArray broadcast_to(UnmanagedStorage from, Shape against)
Parameters
fromUnmanagedStorageThe NDArray to broadcast.
againstShapeThe shape to broadcast against.
Returns
- NDArray
These arrays are views on the original arrays. They are typically not contiguous. Furthermore, more than one element of a broadcasted array may refer to a single memory location. If you need to write to the arrays, make copies first.
Remarks
broadcast_to(NDArray, UnmanagedStorage)
Broadcast an array to a new shape.
public static NDArray broadcast_to(NDArray from, UnmanagedStorage against)
Parameters
fromNDArrayThe NDArray to broadcast.
againstUnmanagedStorageThe shape to broadcast against.
Returns
- NDArray
These arrays are views on the original arrays. They are typically not contiguous. Furthermore, more than one element of a broadcasted array may refer to a single memory location. If you need to write to the arrays, make copies first.
Remarks
broadcast_to(NDArray, NDArray)
Broadcast an array to a new shape.
public static NDArray broadcast_to(NDArray from, NDArray against)
Parameters
Returns
- NDArray
These arrays are views on the original arrays. They are typically not contiguous. Furthermore, more than one element of a broadcasted array may refer to a single memory location. If you need to write to the arrays, make copies first.
Remarks
broadcast_to(NDArray, Shape)
Broadcast an array to a new shape.
public static NDArray broadcast_to(NDArray from, Shape against)
Parameters
Returns
- NDArray
These arrays are views on the original arrays. They are typically not contiguous. Furthermore, more than one element of a broadcasted array may refer to a single memory location. If you need to write to the arrays, make copies first.
Remarks
broadcast_to(Shape, UnmanagedStorage)
Broadcast an shape against an other new shape.
public static Shape broadcast_to(Shape from, UnmanagedStorage against)
Parameters
fromShapeThe shape that is to be broadcasted
againstUnmanagedStorageThe shape that'll be used to broadcast
fromshape
Returns
- Shape
A readonly view on the original array with the given shape. It is typically not contiguous. Furthermore, more than one element of a broadcasted array may refer to a single memory location.
Remarks
broadcast_to(Shape, NDArray)
Broadcast an shape against an other new shape.
public static Shape broadcast_to(Shape from, NDArray against)
Parameters
fromShapeThe shape that is to be broadcasted
againstNDArrayThe shape that'll be used to broadcast
fromshape
Returns
- Shape
A readonly view on the original array with the given shape. It is typically not contiguous. Furthermore, more than one element of a broadcasted array may refer to a single memory location.
Remarks
broadcast_to(Shape, Shape)
Broadcast an shape against an other new shape.
public static Shape broadcast_to(Shape from, Shape against)
Parameters
fromShapeThe shape that is to be broadcasted
againstShapeThe shape that'll be used to broadcast
fromshape
Returns
- Shape
A readonly view on the original array with the given shape. It is typically not contiguous. Furthermore, more than one element of a broadcasted array may refer to a single memory location.
Remarks
ceil(in NDArray, NPTypeCode?)
Return the ceiling of the input, element-wise.
The ceil of the scalar x is the smallest integer i, such that i >= x. It is often denoted as \lceil x \rceil.
public static NDArray ceil(in NDArray x, NPTypeCode? outType = null)
Parameters
xNDArrayInput data.
outTypeNPTypeCode?The dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
The ceiling of each element in x, with float dtype. This is a scalar if x is a scalar.
Remarks
ceil(in NDArray, Type)
Return the ceiling of the input, element-wise.
The ceil of the scalar x is the smallest integer i, such that i >= x. It is often denoted as \lceil x \rceil.
public static NDArray ceil(in NDArray x, Type outType)
Parameters
xNDArrayInput data.
outTypeTypeThe dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
The ceiling of each element in x, with float dtype. This is a scalar if x is a scalar.
Remarks
clip(in NDArray, NDArray, NDArray, NDArray)
Clip (limit) the values in an array.
Given an interval, values outside the interval are clipped to the interval edges. For example, if an interval of [0, 1] is specified, values smaller than 0 become 0, and values larger than 1 become 1.
public static NDArray clip(in NDArray a, NDArray a_min, NDArray a_max, NDArray @out)
Parameters
aNDArrayArray containing elements to clip.
a_minNDArrayMinimum value. If None, clipping is not performed on lower interval edge. Not more than one of a_min and a_max may be None.
a_maxNDArrayMaximum value. If None, clipping is not performed on upper interval edge. Not more than one of a_min and a_max may be None.
outNDArrayThe results will be placed in this array. It may be the input array for in-place clipping. out must be of the right shape to hold the output. Its type is preserved.
Returns
- NDArray
An array with the elements of a, but where values < a_min are replaced with a_min, and those > a_max with a_max.
Remarks
clip(in NDArray, NDArray, NDArray, NPTypeCode?)
Clip (limit) the values in an array.
Given an interval, values outside the interval are clipped to the interval edges. For example, if an interval of [0, 1] is specified, values smaller than 0 become 0, and values larger than 1 become 1.
public static NDArray clip(in NDArray a, NDArray a_min, NDArray a_max, NPTypeCode? outType = null)
Parameters
aNDArrayArray containing elements to clip.
a_minNDArrayMinimum value. If None, clipping is not performed on lower interval edge. Not more than one of a_min and a_max may be None.
a_maxNDArrayMaximum value. If None, clipping is not performed on upper interval edge. Not more than one of a_min and a_max may be None.
outTypeNPTypeCode?The dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
An array with the elements of a, but where values < a_min are replaced with a_min, and those > a_max with a_max.
Remarks
clip(in NDArray, NDArray, NDArray, Type)
Clip (limit) the values in an array.
Given an interval, values outside the interval are clipped to the interval edges. For example, if an interval of [0, 1] is specified, values smaller than 0 become 0, and values larger than 1 become 1.
public static NDArray clip(in NDArray a, NDArray a_min, NDArray a_max, Type outType)
Parameters
aNDArrayArray containing elements to clip.
a_minNDArrayMinimum value. If None, clipping is not performed on lower interval edge. Not more than one of a_min and a_max may be None.
a_maxNDArrayMaximum value. If None, clipping is not performed on upper interval edge. Not more than one of a_min and a_max may be None.
outTypeTypeThe dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
An array with the elements of a, but where values < a_min are replaced with a_min, and those > a_max with a_max.
Remarks
concatenate(NDArray[], int)
Join a sequence of arrays along an existing axis.
public static NDArray concatenate(NDArray[] arrays, int axis = 0)
Parameters
arraysNDArray[]The arrays must have the same shape, except in the dimension corresponding to axis (the first, by default).
axisintThe axis along which the arrays will be joined. If axis is None, arrays are flattened before use. Default is 0.
Returns
- NDArray
The concatenated array.
Remarks
concatenate((NDArray, NDArray, NDArray, NDArray, NDArray, NDArray, NDArray, NDArray, NDArray), int)
Join a sequence of arrays along an existing axis.
public static NDArray concatenate((NDArray, NDArray, NDArray, NDArray, NDArray, NDArray, NDArray, NDArray, NDArray) arrays, int axis = 0)
Parameters
arrays(NDArray, NDArray, NDArray, NDArray, NDArray, NDArray, NDArray, NDArray, NDArray)The arrays must have the same shape, except in the dimension corresponding to axis (the first, by default).
axisintThe axis along which the arrays will be joined. If axis is None, arrays are flattened before use. Default is 0.
Returns
- NDArray
The concatenated array.
Remarks
concatenate((NDArray, NDArray, NDArray, NDArray, NDArray, NDArray, NDArray, NDArray), int)
Join a sequence of arrays along an existing axis.
public static NDArray concatenate((NDArray, NDArray, NDArray, NDArray, NDArray, NDArray, NDArray, NDArray) arrays, int axis = 0)
Parameters
arrays(NDArray, NDArray, NDArray, NDArray, NDArray, NDArray, NDArray, NDArray)The arrays must have the same shape, except in the dimension corresponding to axis (the first, by default).
axisintThe axis along which the arrays will be joined. If axis is None, arrays are flattened before use. Default is 0.
Returns
- NDArray
The concatenated array.
Remarks
concatenate((NDArray, NDArray, NDArray, NDArray, NDArray, NDArray, NDArray), int)
Join a sequence of arrays along an existing axis.
public static NDArray concatenate((NDArray, NDArray, NDArray, NDArray, NDArray, NDArray, NDArray) arrays, int axis = 0)
Parameters
arrays(NDArray, NDArray, NDArray, NDArray, NDArray, NDArray, NDArray)The arrays must have the same shape, except in the dimension corresponding to axis (the first, by default).
axisintThe axis along which the arrays will be joined. If axis is None, arrays are flattened before use. Default is 0.
Returns
- NDArray
The concatenated array.
Remarks
concatenate((NDArray, NDArray, NDArray, NDArray, NDArray, NDArray), int)
Join a sequence of arrays along an existing axis.
public static NDArray concatenate((NDArray, NDArray, NDArray, NDArray, NDArray, NDArray) arrays, int axis = 0)
Parameters
arrays(NDArray, NDArray, NDArray, NDArray, NDArray, NDArray)The arrays must have the same shape, except in the dimension corresponding to axis (the first, by default).
axisintThe axis along which the arrays will be joined. If axis is None, arrays are flattened before use. Default is 0.
Returns
- NDArray
The concatenated array.
Remarks
concatenate((NDArray, NDArray, NDArray, NDArray, NDArray), int)
Join a sequence of arrays along an existing axis.
public static NDArray concatenate((NDArray, NDArray, NDArray, NDArray, NDArray) arrays, int axis = 0)
Parameters
arrays(NDArray, NDArray, NDArray, NDArray, NDArray)The arrays must have the same shape, except in the dimension corresponding to axis (the first, by default).
axisintThe axis along which the arrays will be joined. If axis is None, arrays are flattened before use. Default is 0.
Returns
- NDArray
The concatenated array.
Remarks
concatenate((NDArray, NDArray, NDArray, NDArray), int)
Join a sequence of arrays along an existing axis.
public static NDArray concatenate((NDArray, NDArray, NDArray, NDArray) arrays, int axis = 0)
Parameters
arrays(NDArray, NDArray, NDArray, NDArray)The arrays must have the same shape, except in the dimension corresponding to axis (the first, by default).
axisintThe axis along which the arrays will be joined. If axis is None, arrays are flattened before use. Default is 0.
Returns
- NDArray
The concatenated array.
Remarks
concatenate((NDArray, NDArray, NDArray), int)
Join a sequence of arrays along an existing axis.
public static NDArray concatenate((NDArray, NDArray, NDArray) arrays, int axis = 0)
Parameters
arrays(NDArray, NDArray, NDArray)The arrays must have the same shape, except in the dimension corresponding to axis (the first, by default).
axisintThe axis along which the arrays will be joined. If axis is None, arrays are flattened before use. Default is 0.
Returns
- NDArray
The concatenated array.
Remarks
concatenate((NDArray, NDArray), int)
Join a sequence of arrays along an existing axis.
public static NDArray concatenate((NDArray, NDArray) arrays, int axis = 0)
Parameters
arrays(NDArray Lhs, NDArray Rhs)The arrays must have the same shape, except in the dimension corresponding to axis (the first, by default).
axisintThe axis along which the arrays will be joined. If axis is None, arrays are flattened before use. Default is 0.
Returns
- NDArray
The concatenated array.
Remarks
convolve(NDArray, NDArray, string)
Returns the discrete, linear convolution of two one-dimensional sequences.
The convolution operator is often seen in signal processing, where it models the effect of a linear time-invariant system on a signal[1]. In probability theory, the sum of two independent random variables is distributed according to the convolution of their individual distributions.
If v is longer than a, the arrays are swapped before computation.
public static NDArray convolve(NDArray a, NDArray v, string mode = "full")
Parameters
Returns
copy(NDArray, char)
Return a copy of the array.
public static NDArray copy(NDArray a, char order = 'C')
Parameters
Returns
- NDArray
Array interpretation of a.
Remarks
copyto(NDArray, NDArray)
Copies values from one array to another, broadcasting as necessary.
public static void copyto(NDArray dst, NDArray src)
Parameters
dstNDArrayThe array into which values are copied.
srcNDArrayThe array from which values are copied.
Remarks
cos(in NDArray, NPTypeCode?)
Cosine element-wise.
public static NDArray cos(in NDArray x, NPTypeCode? outType = null)
Parameters
xNDArrayInput array in radians.
outTypeNPTypeCode?The dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
The sine of each element of x. This is a scalar if x is a scalar.
Remarks
cos(in NDArray, Type)
Cosine element-wise.
public static NDArray cos(in NDArray x, Type outType)
Parameters
xNDArrayInput array in radians.
outTypeTypeThe dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
The sine of each element of x. This is a scalar if x is a scalar.
Remarks
cosh(in NDArray, NPTypeCode?)
Hyperbolic cosine, element-wise.
Equivalent to 1/2 * (np.exp(x) + np.exp(-x)) and np.cos(1j* x).
public static NDArray cosh(in NDArray x, NPTypeCode? outType = null)
Parameters
xNDArrayInput array.
outTypeNPTypeCode?The dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
Output array of same shape as x. This is a scalar if x is a scalar.
Remarks
cosh(in NDArray, Type)
Hyperbolic cosine, element-wise.
Equivalent to 1/2 * (np.exp(x) + np.exp(-x)) and np.cos(1j* x).
public static NDArray cosh(in NDArray x, Type outType)
Parameters
xNDArrayInput array.
outTypeTypeThe dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
Output array of same shape as x. This is a scalar if x is a scalar.
Remarks
cumsum(NDArray, int?, NPTypeCode?)
Return the cumulative sum of the elements along a given axis.
public static NDArray cumsum(NDArray arr, int? axis = null, NPTypeCode? typeCode = null)
Parameters
arrNDArrayInput array.
axisint?Axis along which the cumulative sum is computed. The default (None) is to compute the cumsum over the flattened array.
typeCodeNPTypeCode?Type of the returned array and of the accumulator in which the elements are summed. If dtype is not specified, it defaults to the dtype of a, unless a has an integer dtype with a precision less than that of the default platform integer. In that case, the default platform integer is used.
Returns
- NDArray
A new array holding the result is returned unless out is specified, in which case a reference to out is returned. The result has the same size as a, and the same shape as a if axis is not None or a is a 1-d array.
Remarks
divide(in NDArray, in NDArray)
public static NDArray divide(in NDArray x1, in NDArray x2)
Parameters
Returns
Remarks
dot(in NDArray, in NDArray)
Dot product of two arrays. See remarks.
public static NDArray dot(in NDArray a, in NDArray b)
Parameters
Returns
- NDArray
Returns the dot product of a and b. If a and b are both scalars or both 1-D arrays then a scalar is returned; otherwise an array is returned. If out is given, then it is returned.
Remarks
https://numpy.org/doc/stable/reference/generated/numpy.dot.html
Specifically,
- If both a and b are 1-D arrays, it is inner product of vectors (without complex conjugation).
- If both a and b are 2-D arrays, it is matrix multiplication, but using matmul or a @ b is preferred.
- If either a or b is 0-D(scalar), it is equivalent to multiply and using numpy.multiply(a, b) or a* b is preferred.
- If a is an N-D array and b is a 1-D array, it is a sum product over the last axis of a and b.
- If a is an N-D array and b is an M-D array(where M>=2), it is a sum product over the last axis of a and the second-to-last axis of b:
dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m])
dstack(params NDArray[])
Stack arrays in sequence depth wise (along third axis). This is equivalent to concatenation along the third axis after 2-D arrays of shape(M, N) have been reshaped to(M, N,1) and 1-D arrays of shape(N,) have been reshaped to(1, N,1). Rebuilds arrays divided by dsplit. This function makes most sense for arrays with up to 3 dimensions.For instance, for pixel-data with a height(first axis), width(second axis), and r/g/b channels(third axis). The functions concatenate, stack and block provide more general stacking and concatenation operations.
public static NDArray dstack(params NDArray[] tup)
Parameters
tupNDArray[]The arrays must have the same shape along all but the third axis. 1-D or 2-D arrays must have the same shape.
Returns
- NDArray
The array formed by stacking the given arrays, will be at least 3-D.
Remarks
dtype(string)
Parse a string into a DType.
public static DType dtype(string dtype)
Parameters
dtypestring
Returns
Remarks
https://numpy.org/doc/stable/reference/arrays.dtypes.html
This was created to ease the porting of C++ numpy to C#.
empty(Shape)
Return a new array of given shape and type, without initializing entries.
public static NDArray empty(Shape shape)
Parameters
shapeShapeShape of the empty array, e.g., (2, 3) or 2.
Returns
- NDArray
Array of uninitialized (arbitrary) data of the given shape, dtype, and order. Object arrays will be initialized to None.
Remarks
empty(Shape, NPTypeCode)
Return a new array of given shape and type, without initializing entries.
public static NDArray empty(Shape shape, NPTypeCode typeCode)
Parameters
shapeShapeShape of the empty array, e.g., (2, 3) or 2.
typeCodeNPTypeCodeDesired output data-type for the array, e.g, numpy.int8. Default is numpy.float64.
Returns
- NDArray
Array of uninitialized (arbitrary) data of the given shape, dtype, and order. Object arrays will be initialized to None.
Remarks
empty(Shape, Type)
Return a new array of given shape and type, without initializing entries.
public static NDArray empty(Shape shape, Type dtype)
Parameters
shapeShapeShape of the empty array, e.g., (2, 3) or 2.
dtypeTypeDesired output data-type for the array, e.g, numpy.int8. Default is numpy.float64.
Returns
- NDArray
Array of uninitialized (arbitrary) data of the given shape, dtype, and order. Object arrays will be initialized to None.
Remarks
empty(params int[])
Return a new array of given shape and type, without initializing entries.
public static NDArray empty(params int[] shapes)
Parameters
shapesint[]Shape of the empty array, e.g., (2, 3) or 2.
Returns
- NDArray
Array of uninitialized (arbitrary) data of the given shape, dtype, and order. Object arrays will be initialized to None.
Remarks
empty_like(NDArray, NPTypeCode, Shape)
Return a new array with the same shape and type as a given array.
public static NDArray empty_like(NDArray prototype, NPTypeCode typeCode, Shape shape = default)
Parameters
prototypeNDArrayThe shape and data-type of prototype define these same attributes of the returned array.
typeCodeNPTypeCodeOverrides the data type of the result.
shapeShapeOverrides the shape of the result.
Returns
- NDArray
Array of uninitialized (arbitrary) data with the same shape and type as prototype.
Remarks
empty_like(NDArray, Type, Shape)
Return a new array with the same shape and type as a given array.
public static NDArray empty_like(NDArray prototype, Type dtype = null, Shape shape = default)
Parameters
prototypeNDArrayThe shape and data-type of prototype define these same attributes of the returned array.
dtypeTypeOverrides the data type of the result.
shapeShapeOverrides the shape of the result.
Returns
- NDArray
Array of uninitialized (arbitrary) data with the same shape and type as prototype.
Remarks
empty<T>(params int[])
Return a new array of given shape and type, without initializing entries.
public static NDArray empty<T>(params int[] shapes)
Parameters
shapesint[]Shape of the empty array, e.g., (2, 3) or 2.
Returns
- NDArray
Array of uninitialized (arbitrary) data of the given shape, dtype, and order. Object arrays will be initialized to None.
Type Parameters
T
Remarks
exp(in NDArray)
Base-e exponential, element-wise.
public static NDArray exp(in NDArray a)
Parameters
aNDArrayInput value.
Returns
- NDArray
The natural logarithm of x, element-wise. This is a scalar NDArray.
Remarks
exp(in NDArray, NPTypeCode)
Base-e exponential, element-wise.
public static NDArray exp(in NDArray a, NPTypeCode typeCode)
Parameters
aNDArrayInput value.
typeCodeNPTypeCodeThe dtype of the returned NDArray
Returns
- NDArray
The natural logarithm of x, element-wise. This is a scalar NDArray.
Remarks
exp(in NDArray, Type)
Base-e exponential, element-wise.
public static NDArray exp(in NDArray a, Type dtype)
Parameters
Returns
- NDArray
The natural logarithm of x, element-wise. This is a scalar NDArray.
Remarks
exp2(in NDArray)
Calculate 2**p for all p in the input array.
public static NDArray exp2(in NDArray a)
Parameters
aNDArrayInput value.
Returns
- NDArray
Element-wise 2 to the power x. This is a scalar if x is a scalar.
Remarks
exp2(in NDArray, NPTypeCode)
Calculate 2**p for all p in the input array.
public static NDArray exp2(in NDArray a, NPTypeCode typeCode)
Parameters
aNDArrayInput value.
typeCodeNPTypeCode
Returns
- NDArray
Element-wise 2 to the power x. This is a scalar if x is a scalar.
Remarks
exp2(in NDArray, Type)
Calculate 2**p for all p in the input array.
public static NDArray exp2(in NDArray a, Type dtype)
Parameters
Returns
- NDArray
Element-wise 2 to the power x. This is a scalar if x is a scalar.
Remarks
expand_dims(NDArray, int)
public static NDArray expand_dims(NDArray a, int axis)
Parameters
Returns
expm1(in NDArray)
Calculate exp(x) - 1 for all elements in the array.
public static NDArray expm1(in NDArray a)
Parameters
aNDArrayInput value.
Returns
- NDArray
Element-wise exponential minus one: out = exp(x) - 1. This is a scalar if x is a scalar.
Remarks
expm1(in NDArray, NPTypeCode)
Calculate exp(x) - 1 for all elements in the array.
public static NDArray expm1(in NDArray a, NPTypeCode typeCode)
Parameters
aNDArrayInput value.
typeCodeNPTypeCode
Returns
- NDArray
Element-wise exponential minus one: out = exp(x) - 1. This is a scalar if x is a scalar.
Remarks
expm1(in NDArray, Type)
Calculate exp(x) - 1 for all elements in the array.
public static NDArray expm1(in NDArray a, Type dtype)
Parameters
Returns
- NDArray
Element-wise exponential minus one: out = exp(x) - 1. This is a scalar if x is a scalar.
Remarks
eye(int, int?, int, Type)
Return a 2-D array with ones on the diagonal and zeros elsewhere.
public static NDArray eye(int N, int? M = null, int k = 0, Type dtype = null)
Parameters
NintNumber of rows in the output.
Mint?Number of columns in the output. If None, defaults to N.
kintIndex of the diagonal: 0 (the default) refers to the main diagonal, a positive value refers to an upper diagonal, and a negative value to a lower diagonal.
dtypeTypeData-type of the returned array.
Returns
- NDArray
An array where all elements are equal to zero, except for the k-th diagonal, whose values are equal to one.
Remarks
find_common_type(NPTypeCode[], NPTypeCode[])
Determine common type following standard coercion rules.
public static NPTypeCode find_common_type(NPTypeCode[] array_types, NPTypeCode[] scalar_types)
Parameters
array_typesNPTypeCode[]A list of dtypes or dtype convertible objects representing arrays. Can be null.
scalar_typesNPTypeCode[]A list of dtypes or dtype convertible objects representing scalars.Can be null.
Returns
- NPTypeCode
The common data type, which is the maximum of array_types ignoring scalar_types, unless the maximum of scalar_types is of a different kind (dtype.kind). If the kind is not understood, then None is returned.
Remarks
find_common_type(NPTypeCode[], Type[])
Determine common type following standard coercion rules.
public static NPTypeCode find_common_type(NPTypeCode[] array_types, Type[] scalar_types)
Parameters
array_typesNPTypeCode[]A list of dtypes or dtype convertible objects representing arrays. Can be null.
scalar_typesType[]A list of dtypes or dtype convertible objects representing scalars.Can be null.
Returns
- NPTypeCode
The common data type, which is the maximum of array_types ignoring scalar_types, unless the maximum of scalar_types is of a different kind (dtype.kind). If the kind is not understood, then None is returned.
Remarks
find_common_type(params string[])
Resolves to which type should the output be.
public static NPTypeCode find_common_type(params string[] involvedTypes)
Parameters
involvedTypesstring[]
Returns
find_common_type(string[], string[])
Determine common type following standard coercion rules.
public static NPTypeCode find_common_type(string[] array_types, string[] scalar_types)
Parameters
array_typesstring[]A list of dtypes or dtype convertible objects representing arrays. Can be null.
scalar_typesstring[]A list of dtypes or dtype convertible objects representing scalars.Can be null.
Returns
- NPTypeCode
The common data type, which is the maximum of array_types ignoring scalar_types, unless the maximum of scalar_types is of a different kind (dtype.kind). If the kind is not understood, then None is returned.
Remarks
find_common_type(Type[])
Determine common type following standard coercion rules.
public static NPTypeCode find_common_type(Type[] array_types)
Parameters
array_typesType[]A list of dtypes or dtype convertible objects representing arrays. Can be null.
Returns
- NPTypeCode
The common data type, which is the maximum of array_types ignoring scalar_types, unless the maximum of scalar_types is of a different kind (dtype.kind). If the kind is not understood, then None is returned.
Remarks
find_common_type(Type[], NPTypeCode[])
Determine common type following standard coercion rules.
public static NPTypeCode find_common_type(Type[] array_types, NPTypeCode[] scalar_types)
Parameters
array_typesType[]A list of dtypes or dtype convertible objects representing arrays. Can be null.
scalar_typesNPTypeCode[]A list of dtypes or dtype convertible objects representing scalars.Can be null.
Returns
- NPTypeCode
The common data type, which is the maximum of array_types ignoring scalar_types, unless the maximum of scalar_types is of a different kind (dtype.kind). If the kind is not understood, then None is returned.
Remarks
find_common_type(Type[], Type[])
Determine common type following standard coercion rules.
public static NPTypeCode find_common_type(Type[] array_types, Type[] scalar_types)
Parameters
array_typesType[]A list of dtypes or dtype convertible objects representing arrays. Can be null.
scalar_typesType[]A list of dtypes or dtype convertible objects representing scalars.Can be null.
Returns
- NPTypeCode
The common data type, which is the maximum of array_types ignoring scalar_types, unless the maximum of scalar_types is of a different kind (dtype.kind). If the kind is not understood, then None is returned.
Remarks
floor(in NDArray, NPTypeCode?)
public static NDArray floor(in NDArray x, NPTypeCode? outType = null)
Parameters
xNDArrayoutTypeNPTypeCode?
Returns
floor(in NDArray, Type)
public static NDArray floor(in NDArray x, Type outType)
Parameters
Returns
fmax(in NDArray, in NDArray, NDArray)
Element-wise maximum of array elements. Compare two arrays and returns a new array containing the element-wise maxima. If one of the elements being compared is a NaN, then the non-nan element is returned. If both elements are NaNs then the first is returned. The latter distinction is important for complex NaNs, which are defined as at least one of the real or imaginary parts being a NaN. The net effect is that NaNs are ignored when possible.
public static NDArray fmax(in NDArray x1, in NDArray x2, NDArray @out)
Parameters
x1NDArrayThe arrays holding the elements to be compared. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
x2NDArrayThe arrays holding the elements to be compared. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
outNDArray
Returns
- NDArray
The maximum of x1 and x2, element-wise. This is a scalar if both x1 and x2 are scalars.
fmax(in NDArray, in NDArray, NPTypeCode?)
Element-wise maximum of array elements. Compare two arrays and returns a new array containing the element-wise maxima. If one of the elements being compared is a NaN, then the non-nan element is returned. If both elements are NaNs then the first is returned. The latter distinction is important for complex NaNs, which are defined as at least one of the real or imaginary parts being a NaN. The net effect is that NaNs are ignored when possible.
public static NDArray fmax(in NDArray x1, in NDArray x2, NPTypeCode? outType = null)
Parameters
x1NDArrayThe arrays holding the elements to be compared. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
x2NDArrayThe arrays holding the elements to be compared. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
outTypeNPTypeCode?
Returns
- NDArray
The maximum of x1 and x2, element-wise. This is a scalar if both x1 and x2 are scalars.
fmax(in NDArray, in NDArray, Type)
Element-wise maximum of array elements. Compare two arrays and returns a new array containing the element-wise maxima. If one of the elements being compared is a NaN, then the non-nan element is returned. If both elements are NaNs then the first is returned. The latter distinction is important for complex NaNs, which are defined as at least one of the real or imaginary parts being a NaN. The net effect is that NaNs are ignored when possible.
public static NDArray fmax(in NDArray x1, in NDArray x2, Type outType)
Parameters
x1NDArrayThe arrays holding the elements to be compared. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
x2NDArrayThe arrays holding the elements to be compared. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
outTypeType
Returns
- NDArray
The maximum of x1 and x2, element-wise. This is a scalar if both x1 and x2 are scalars.
fmin(in NDArray, in NDArray, NDArray)
Element-wise maximum of array elements. Compare two arrays and returns a new array containing the element-wise maxima.If one of the elements being compared is a NaN, then that element is returned.If both elements are NaNs then the first is returned.The latter distinction is important for complex NaNs, which are defined as at least one of the real or imaginary parts being a NaN. The net effect is that NaNs are propagated.
public static NDArray fmin(in NDArray x1, in NDArray x2, NDArray @out)
Parameters
x1NDArrayThe arrays holding the elements to be compared. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
x2NDArrayThe arrays holding the elements to be compared. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
outNDArray
Returns
- NDArray
The maximum of x1 and x2, element-wise. This is a scalar if both x1 and x2 are scalars.
fmin(in NDArray, in NDArray, NPTypeCode?)
Element-wise maximum of array elements. Compare two arrays and returns a new array containing the element-wise maxima.If one of the elements being compared is a NaN, then that element is returned.If both elements are NaNs then the first is returned.The latter distinction is important for complex NaNs, which are defined as at least one of the real or imaginary parts being a NaN. The net effect is that NaNs are propagated.
public static NDArray fmin(in NDArray x1, in NDArray x2, NPTypeCode? outType = null)
Parameters
x1NDArrayThe arrays holding the elements to be compared. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
x2NDArrayThe arrays holding the elements to be compared. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
outTypeNPTypeCode?
Returns
- NDArray
The maximum of x1 and x2, element-wise. This is a scalar if both x1 and x2 are scalars.
fmin(in NDArray, in NDArray, Type)
Element-wise maximum of array elements. Compare two arrays and returns a new array containing the element-wise maxima.If one of the elements being compared is a NaN, then that element is returned.If both elements are NaNs then the first is returned.The latter distinction is important for complex NaNs, which are defined as at least one of the real or imaginary parts being a NaN. The net effect is that NaNs are propagated.
public static NDArray fmin(in NDArray x1, in NDArray x2, Type outType)
Parameters
x1NDArrayThe arrays holding the elements to be compared. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
x2NDArrayThe arrays holding the elements to be compared. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
outTypeType
Returns
- NDArray
The maximum of x1 and x2, element-wise. This is a scalar if both x1 and x2 are scalars.
frombuffer(byte[], string)
public static NDArray frombuffer(byte[] bytes, string dtype)
Parameters
Returns
frombuffer(byte[], Type)
public static NDArray frombuffer(byte[] bytes, Type dtype)
Parameters
Returns
fromfile(string, NPTypeCode)
Construct an array from data in a text or binary file. A highly efficient way of reading binary data with a known data-type, as well as parsing simply formatted text files. Data written using the tofile method can be read using this function.
public static NDArray fromfile(string file, NPTypeCode dtype)
Parameters
filestringfilename.
dtypeNPTypeCodeData type of the returned array. For binary files, it is used to determine the size and byte-order of the items in the file.
Returns
Remarks
fromfile(string, Type)
Construct an array from data in a text or binary file. A highly efficient way of reading binary data with a known data-type, as well as parsing simply formatted text files. Data written using the tofile method can be read using this function.
public static NDArray fromfile(string file, Type dtype)
Parameters
filestringfilename.
dtypeTypeData type of the returned array. For binary files, it is used to determine the size and byte-order of the items in the file.
Returns
Remarks
full(Shape, ValueType)
Return a new array of given shape and type, filled with fill_value.
public static NDArray full(Shape shape, ValueType fill_value)
Parameters
Returns
- NDArray
Array of fill_value with the given shape, dtype, and order.
Remarks
full(Shape, ValueType, NPTypeCode)
Return a new array of given shape and type, filled with fill_value.
public static NDArray full(Shape shape, ValueType fill_value, NPTypeCode typeCode)
Parameters
shapeShapeShape of the empty array, e.g., (2, 3) or 2.
fill_valueValueTypeFill value.
typeCodeNPTypeCodeThe desired data-type for the array The default, null, means np.array(fill_value).dtype.
Returns
- NDArray
Array of fill_value with the given shape, dtype, and order.
Remarks
full(Shape, ValueType, Type)
Return a new array of given shape and type, filled with fill_value.
public static NDArray full(Shape shape, ValueType fill_value, Type dtype)
Parameters
shapeShapeShape of the empty array, e.g., (2, 3) or 2.
fill_valueValueTypeFill value.
dtypeTypeThe desired data-type for the array The default, null, means np.array(fill_value).dtype.
Returns
- NDArray
Array of fill_value with the given shape, dtype, and order.
Remarks
full(ValueType, Shape)
Return a new array of given shape and type, filled with fill_value.
public static NDArray full(ValueType fill_value, Shape shape)
Parameters
Returns
- NDArray
Array of fill_value with the given shape, dtype, and order.
Remarks
full(ValueType, Shape, NPTypeCode)
Return a new array of given shape and type, filled with fill_value.
public static NDArray full(ValueType fill_value, Shape shape, NPTypeCode typeCode)
Parameters
fill_valueValueTypeFill value.
shapeShapeShape of the empty array, e.g., (2, 3) or 2.
typeCodeNPTypeCodeThe desired data-type for the array The default, null, means np.array(fill_value).dtype.
Returns
- NDArray
Array of fill_value with the given shape, dtype, and order.
Remarks
full(ValueType, Shape, Type)
Return a new array of given shape and type, filled with fill_value.
public static NDArray full(ValueType fill_value, Shape shape, Type dtype)
Parameters
fill_valueValueTypeFill value.
shapeShapeShape of the empty array, e.g., (2, 3) or 2.
dtypeTypeThe desired data-type for the array The default, null, means np.array(fill_value).dtype.
Returns
- NDArray
Array of fill_value with the given shape, dtype, and order.
Remarks
full(ValueType, params int[])
Return a new array of given shape and type, filled with fill_value.
public static NDArray full(ValueType fill_value, params int[] shapes)
Parameters
Returns
- NDArray
Array of fill_value with the given shape, dtype, and order.
Remarks
full_like(NDArray, object, Type)
Return a full array with the same shape and type as a given array.
public static NDArray full_like(NDArray a, object fill_value, Type dtype = null)
Parameters
aNDArrayThe shape and data-type of a define these same attributes of the returned array.
fill_valueobjectFill value.
dtypeTypeOverrides the data type of the result.
Returns
- NDArray
Array of fill_value with the same shape and type as a.
Remarks
full<T>(ValueType, params int[])
Return a new array of given shape and type, filled with fill_value.
public static NDArray full<T>(ValueType fill_value, params int[] shapes) where T : unmanaged
Parameters
Returns
- NDArray
Array of fill_value with the given shape, dtype, and order.
Type Parameters
T
Remarks
hstack(params NDArray[])
Stack arrays in sequence horizontally (column wise). This is equivalent to concatenation along the second axis, except for 1-D arrays where it concatenates along the first axis.Rebuilds arrays divided by hsplit. This function makes most sense for arrays with up to 3 dimensions.For instance, for pixel-data with a height(first axis), width(second axis), and r/g/b channels(third axis). The functions concatenate, stack and block provide more general stacking and concatenation operations.
public static NDArray hstack(params NDArray[] tup)
Parameters
tupNDArray[]The arrays must have the same shape along all but the second axis, except 1-D arrays which can be any length.
Returns
- NDArray
The array formed by stacking the given arrays.
Remarks
identity(int, Type)
Return the identity array. The identity array is a square array with ones on the main diagonal.
public static NDArray identity(int n, Type dtype = null)
Parameters
nintNumber of rows (and columns) in n x n output.
dtypeTypeData-type of the output. Defaults to double.
Returns
- NDArray
n x n array with its main diagonal set to one, and all other elements 0.
Remarks
isclose(NDArray, NDArray, double, double, bool)
Returns a boolean array where two arrays are element-wise equal within a
tolerance.
The tolerance values are positive, typically very small numbers.The
relative difference (rtol * abs(b)) and the absolute difference
atol are added together to compare against the absolute difference
between a and b.
Warning: The default atol is not appropriate for comparing numbers
that are much smaller than one(see Notes).
See also allclose(NDArray, NDArray, double, double, bool)
Notes: For finite values, isclose uses the following equation to test whether two floating point values are equivalent.
absolute(`a` - `b`) less than or equal to (`atol` + `rtol` * absolute(`b`))
Unlike the built-in math.isclose, the above equation is not symmetric
in a and b -- it assumes b is the reference value -- so that
isclose(a, b) might be different from isclose(b, a). Furthermore,
the default value of atol is not zero, and is used to determine what
small values should be considered close to zero.The default value is
appropriate for expected values of order unity: if the expected values
are significantly smaller than one, it can result in false positives.
atol should be carefully selected for the use case at hand. A zero value
for atol will result in False if either a or b is zero.
public static NDArray<bool> isclose(NDArray a, NDArray b, double rtol = 1E-05, double atol = 1E-08, bool equal_nan = false)
Parameters
aNDArrayInput array to compare with b
bNDArrayInput array to compare with a.
rtoldoubleThe relative tolerance parameter(see Notes)
atoldoubleThe absolute tolerance parameter(see Notes)
equal_nanboolWhether to compare NaN's as equal. If True, NaN's in
awill be considered equal to NaN's inbin the output array.
Returns
- NDArray<bool>
Returns a boolean array of where
aandbare equal within the given tolerance.If bothaandbare scalars, returns a single boolean value.
isfinite(NDArray)
Test element-wise for finiteness (not infinity or not Not a Number).
public static NDArray<bool> isfinite(NDArray a)
Parameters
aNDArray
Returns
isnan(NDArray)
Test element-wise for Not a Number.
public static NDArray<bool> isnan(NDArray a)
Parameters
aNDArray
Returns
isscalar(object)
Returns true incase of a number, bool or string. If null, returns false.
public static bool isscalar(object obj)
Parameters
objobject
Returns
Remarks
linspace(double, double, int, bool, NPTypeCode)
Return evenly spaced numbers over a specified interval.
Returns num evenly spaced samples, calculated over the interval[start, stop].
The endpoint of the interval can optionally be excluded.
public static NDArray linspace(double start, double stop, int num, bool endpoint = true, NPTypeCode typeCode = NPTypeCode.Double)
Parameters
startdoubleThe starting value of the sequence.
stopdoubleThe end value of the sequence, unless endpoint is set to False. In that case, the sequence consists of all but the last of num + 1 evenly spaced samples, so that stop is excluded. Note that the step size changes when endpoint is False.
numintNumber of samples to generate. Default is 50. Must be non-negative.
endpointboolIf True, stop is the last sample. Otherwise, it is not included. Default is True.
typeCodeNPTypeCodeThe type of the output array. If dtype is not given, infer the data type from the other input arguments.
Returns
Remarks
linspace(double, double, int, bool, Type)
Return evenly spaced numbers over a specified interval.
Returns num evenly spaced samples, calculated over the interval[start, stop].
The endpoint of the interval can optionally be excluded.
public static NDArray linspace(double start, double stop, int num, bool endpoint, Type dtype)
Parameters
startdoubleThe starting value of the sequence.
stopdoubleThe end value of the sequence, unless endpoint is set to False. In that case, the sequence consists of all but the last of num + 1 evenly spaced samples, so that stop is excluded. Note that the step size changes when endpoint is False.
numintNumber of samples to generate. Default is 50. Must be non-negative.
endpointboolIf True, stop is the last sample. Otherwise, it is not included. Default is True.
dtypeTypeThe type of the output array. If dtype is not given, infer the data type from the other input arguments.
Returns
Remarks
linspace(float, float, int, bool, NPTypeCode)
Return evenly spaced numbers over a specified interval.
Returns num evenly spaced samples, calculated over the interval[start, stop].
The endpoint of the interval can optionally be excluded.
public static NDArray linspace(float start, float stop, int num, bool endpoint = true, NPTypeCode typeCode = NPTypeCode.Float)
Parameters
startfloatThe starting value of the sequence.
stopfloatThe end value of the sequence, unless endpoint is set to False. In that case, the sequence consists of all but the last of num + 1 evenly spaced samples, so that stop is excluded. Note that the step size changes when endpoint is False.
numintNumber of samples to generate. Default is 50. Must be non-negative.
endpointboolIf True, stop is the last sample. Otherwise, it is not included. Default is True.
typeCodeNPTypeCodeThe type of the output array. If dtype is not given, infer the data type from the other input arguments.
Returns
Remarks
linspace(float, float, int, bool, Type)
Return evenly spaced numbers over a specified interval.
Returns num evenly spaced samples, calculated over the interval[start, stop].
The endpoint of the interval can optionally be excluded.
public static NDArray linspace(float start, float stop, int num, bool endpoint, Type dtype)
Parameters
startfloatThe starting value of the sequence.
stopfloatThe end value of the sequence, unless endpoint is set to False. In that case, the sequence consists of all but the last of num + 1 evenly spaced samples, so that stop is excluded. Note that the step size changes when endpoint is False.
numintNumber of samples to generate. Default is 50. Must be non-negative.
endpointboolIf True, stop is the last sample. Otherwise, it is not included. Default is True.
dtypeTypeThe type of the output array. If dtype is not given, infer the data type from the other input arguments.
Returns
Remarks
load(Stream)
public static NDArray load(Stream stream)
Parameters
streamStream
Returns
load(string)
public static NDArray load(string path)
Parameters
pathstring
Returns
log(in NDArray)
Natural logarithm, element-wise. The natural logarithm log is the inverse of the exponential function, so that log(exp(x)) = x. The natural logarithm is logarithm in base e.
public static NDArray log(in NDArray x)
Parameters
xNDArrayInput value.
Returns
- NDArray
The natural logarithm of x, element-wise. This is a scalar if x is a scalar.
Remarks
log(in NDArray, NPTypeCode?)
Natural logarithm, element-wise. The natural logarithm log is the inverse of the exponential function, so that log(exp(x)) = x. The natural logarithm is logarithm in base e.
public static NDArray log(in NDArray x, NPTypeCode? outType = null)
Parameters
xNDArrayInput value.
outTypeNPTypeCode?The dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
The natural logarithm of x, element-wise. This is a scalar if x is a scalar.
Remarks
log(in NDArray, Type)
Natural logarithm, element-wise. The natural logarithm log is the inverse of the exponential function, so that log(exp(x)) = x. The natural logarithm is logarithm in base e.
public static NDArray log(in NDArray x, Type outType)
Parameters
xNDArrayInput value.
outTypeTypeThe dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
The natural logarithm of x, element-wise. This is a scalar if x is a scalar.
Remarks
log10(in NDArray)
Return the base 10 logarithm of the input array, element-wise.
public static NDArray log10(in NDArray x)
Parameters
xNDArrayInput value.
Returns
- NDArray
The logarithm to the base 10 of x, element-wise. NaNs are returned where x is negative. This is a scalar if x is a scalar.
Remarks
log10(in NDArray, NPTypeCode?)
Return the base 10 logarithm of the input array, element-wise.
public static NDArray log10(in NDArray x, NPTypeCode? outType = null)
Parameters
xNDArrayInput value.
outTypeNPTypeCode?
Returns
- NDArray
The logarithm to the base 10 of x, element-wise. NaNs are returned where x is negative. This is a scalar if x is a scalar.
Remarks
log10(in NDArray, Type)
Return the base 10 logarithm of the input array, element-wise.
public static NDArray log10(in NDArray x, Type outType)
Parameters
Returns
- NDArray
The logarithm to the base 10 of x, element-wise. NaNs are returned where x is negative. This is a scalar if x is a scalar.
Remarks
log1p(in NDArray)
Return the natural logarithm of one plus the input array, element-wise.
Calculates log(1 + x).
public static NDArray log1p(in NDArray x)
Parameters
xNDArrayInput value.
Returns
- NDArray
Natural logarithm of 1 + x, element-wise. This is a scalar if x is a scalar.
Remarks
log1p(in NDArray, NPTypeCode?)
Return the natural logarithm of one plus the input array, element-wise.
Calculates log(1 + x).
public static NDArray log1p(in NDArray x, NPTypeCode? outType = null)
Parameters
xNDArrayInput value.
outTypeNPTypeCode?
Returns
- NDArray
Natural logarithm of 1 + x, element-wise. This is a scalar if x is a scalar.
Remarks
log1p(in NDArray, Type)
Return the natural logarithm of one plus the input array, element-wise.
Calculates log(1 + x).
public static NDArray log1p(in NDArray x, Type outType)
Parameters
Returns
- NDArray
Natural logarithm of 1 + x, element-wise. This is a scalar if x is a scalar.
Remarks
log2(in NDArray)
Base-2 logarithm of x.
public static NDArray log2(in NDArray x)
Parameters
xNDArrayInput value.
Returns
- NDArray
Base-2 logarithm of x. This is a scalar if x is a scalar.
Remarks
log2(in NDArray, NPTypeCode?)
Base-2 logarithm of x.
public static NDArray log2(in NDArray x, NPTypeCode? outType = null)
Parameters
xNDArrayInput value.
outTypeNPTypeCode?
Returns
- NDArray
Base-2 logarithm of x. This is a scalar if x is a scalar.
Remarks
log2(in NDArray, Type)
Base-2 logarithm of x.
public static NDArray log2(in NDArray x, Type outType)
Parameters
Returns
- NDArray
Base-2 logarithm of x. This is a scalar if x is a scalar.
Remarks
matmul(in NDArray, in NDArray)
Matrix product of two arrays.
public static NDArray matmul(in NDArray x1, in NDArray x2)
Parameters
Returns
- NDArray
The matrix product of the inputs. This is a scalar only when both x1, x2 are 1-d vectors.
Remarks
max(NDArray, int?, bool, Type)
Return the maximum of an array or maximum along an axis.
public static NDArray max(NDArray a, int? axis = null, bool keepdims = false, Type dtype = null)
Parameters
aNDArrayaxisint?Axis or axes along which to operate.
keepdimsboolIf this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.
dtypeTypethe type expected as a return, null will remain the same dtype.
Returns
- NDArray
Maximum of a. If axis is None, the result is a scalar value. If axis is given, the result is an array of dimension a.ndim - 1.
Remarks
maximum(in NDArray, in NDArray, NDArray)
Element-wise maximum of array elements. Compare two arrays and returns a new array containing the element-wise maxima.If one of the elements being compared is a NaN, then that element is returned.If both elements are NaNs then the first is returned.The latter distinction is important for complex NaNs, which are defined as at least one of the real or imaginary parts being a NaN. The net effect is that NaNs are propagated.
public static NDArray maximum(in NDArray x1, in NDArray x2, NDArray @out)
Parameters
x1NDArrayThe arrays holding the elements to be compared. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
x2NDArrayThe arrays holding the elements to be compared. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
outNDArray
Returns
- NDArray
The maximum of x1 and x2, element-wise. This is a scalar if both x1 and x2 are scalars.
maximum(in NDArray, in NDArray, NPTypeCode?)
Element-wise maximum of array elements. Compare two arrays and returns a new array containing the element-wise maxima.If one of the elements being compared is a NaN, then that element is returned.If both elements are NaNs then the first is returned.The latter distinction is important for complex NaNs, which are defined as at least one of the real or imaginary parts being a NaN. The net effect is that NaNs are propagated.
public static NDArray maximum(in NDArray x1, in NDArray x2, NPTypeCode? outType = null)
Parameters
x1NDArrayThe arrays holding the elements to be compared. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
x2NDArrayThe arrays holding the elements to be compared. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
outTypeNPTypeCode?
Returns
- NDArray
The maximum of x1 and x2, element-wise. This is a scalar if both x1 and x2 are scalars.
maximum(in NDArray, in NDArray, Type)
Element-wise maximum of array elements. Compare two arrays and returns a new array containing the element-wise maxima.If one of the elements being compared is a NaN, then that element is returned.If both elements are NaNs then the first is returned.The latter distinction is important for complex NaNs, which are defined as at least one of the real or imaginary parts being a NaN. The net effect is that NaNs are propagated.
public static NDArray maximum(in NDArray x1, in NDArray x2, Type outType)
Parameters
x1NDArrayThe arrays holding the elements to be compared. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
x2NDArrayThe arrays holding the elements to be compared. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
outTypeType
Returns
- NDArray
The maximum of x1 and x2, element-wise. This is a scalar if both x1 and x2 are scalars.
mean(in NDArray)
Compute the arithmetic mean along the specified axis. Returns the average of the array elements. The average is taken over the flattened array by default, otherwise over the specified axis. float64 intermediate and return values are used for integer inputs.
public static NDArray mean(in NDArray a)
Parameters
aNDArrayArray containing numbers whose mean is desired. If a is not an array, a conversion is attempted.
Returns
- NDArray
returns a new array containing the mean values, otherwise a reference to the output array is returned.
Remarks
mean(in NDArray, bool)
Compute the arithmetic mean along the specified axis. Returns the average of the array elements. The average is taken over the flattened array by default, otherwise over the specified axis. float64 intermediate and return values are used for integer inputs.
public static NDArray mean(in NDArray a, bool keepdims)
Parameters
aNDArrayArray containing numbers whose mean is desired. If a is not an array, a conversion is attempted.
keepdimsboolIf this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array. If the default value is passed, then keepdims will not be passed through to the mean method of sub-classes of ndarray, however any non-default value will be.If the sub-class’ method does not implement keepdims any exceptions will be raised.
Returns
- NDArray
returns a new array containing the mean values, otherwise a reference to the output array is returned.
Remarks
mean(in NDArray, int)
Compute the arithmetic mean along the specified axis. Returns the average of the array elements. The average is taken over the flattened array by default, otherwise over the specified axis. float64 intermediate and return values are used for integer inputs.
public static NDArray mean(in NDArray a, int axis)
Parameters
aNDArrayArray containing numbers whose mean is desired. If a is not an array, a conversion is attempted.
axisintAxis or axes along which the means are computed. The default is to compute the mean of the flattened array.
Returns
- NDArray
returns a new array containing the mean values, otherwise a reference to the output array is returned.
Remarks
mean(in NDArray, int, NPTypeCode, bool)
Compute the arithmetic mean along the specified axis. Returns the average of the array elements. The average is taken over the flattened array by default, otherwise over the specified axis. float64 intermediate and return values are used for integer inputs.
public static NDArray mean(in NDArray a, int axis, NPTypeCode type, bool keepdims = false)
Parameters
aNDArrayArray containing numbers whose mean is desired. If a is not an array, a conversion is attempted.
axisintAxis or axes along which the means are computed. The default is to compute the mean of the flattened array.
typeNPTypeCodeType to use in computing the mean. For integer inputs, the default is float64; for floating point inputs, it is the same as the input dtype.
keepdimsboolIf this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array. If the default value is passed, then keepdims will not be passed through to the mean method of sub-classes of ndarray, however any non-default value will be.If the sub-class’ method does not implement keepdims any exceptions will be raised.
Returns
- NDArray
returns a new array containing the mean values, otherwise a reference to the output array is returned.
Remarks
mean(in NDArray, int, bool)
Compute the arithmetic mean along the specified axis. Returns the average of the array elements. The average is taken over the flattened array by default, otherwise over the specified axis. float64 intermediate and return values are used for integer inputs.
public static NDArray mean(in NDArray a, int axis, bool keepdims)
Parameters
aNDArrayArray containing numbers whose mean is desired. If a is not an array, a conversion is attempted.
axisintAxis or axes along which the means are computed. The default is to compute the mean of the flattened array.
keepdimsboolIf this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array. If the default value is passed, then keepdims will not be passed through to the mean method of sub-classes of ndarray, however any non-default value will be.If the sub-class’ method does not implement keepdims any exceptions will be raised.
Returns
- NDArray
returns a new array containing the mean values, otherwise a reference to the output array is returned.
mean(in NDArray, int, Type, bool)
Compute the arithmetic mean along the specified axis. Returns the average of the array elements. The average is taken over the flattened array by default, otherwise over the specified axis. float64 intermediate and return values are used for integer inputs.
public static NDArray mean(in NDArray a, int axis, Type dtype, bool keepdims = false)
Parameters
aNDArrayArray containing numbers whose mean is desired. If a is not an array, a conversion is attempted.
axisintAxis or axes along which the means are computed. The default is to compute the mean of the flattened array.
dtypeTypeType to use in computing the mean. For integer inputs, the default is float64; for floating point inputs, it is the same as the input dtype.
keepdimsboolIf this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array. If the default value is passed, then keepdims will not be passed through to the mean method of sub-classes of ndarray, however any non-default value will be.If the sub-class’ method does not implement keepdims any exceptions will be raised.
Returns
- NDArray
returns a new array containing the mean values, otherwise a reference to the output array is returned.
Remarks
meshgrid(NDArray, NDArray, Kwargs)
Return coordinate matrices from coordinate vectors. Make N-D coordinate arrays for vectorized evaluations of N-D scalar/vector fields over N-D grids, given one-dimensional coordinate arrays x1, x2,..., xn. .. versionchanged:: 1.9 1-D and 0-D cases are allowed.
public static (NDArray, NDArray) meshgrid(NDArray x1, NDArray x2, Kwargs kwargs = null)
Parameters
x1NDArray1-D arrays representing the coordinates of a grid
x2NDArray1-D arrays representing the coordinates of a grid
kwargsKwargs
Returns
mgrid(NDArray, NDArray)
nd_grid instance which returns a dense multi-dimensional “meshgrid”. An instance of numpy.lib.index_tricks.nd_grid which returns an dense (or fleshed out) mesh-grid when indexed, so that each returned argument has the same shape. The dimensions and number of the output arrays are equal to the number of indexing dimensions.If the step length is not a complex number, then the stop is not inclusive.
public static (NDArray, NDArray) mgrid(NDArray lhs, NDArray rhs)
Parameters
Returns
Remarks
min(in NDArray, int?, bool, Type)
Return the minimum of an array or minimum along an axis.
public static NDArray min(in NDArray a, int? axis = null, bool keepdims = false, Type dtype = null)
Parameters
aNDArrayInput data.
axisint?Axis or axes along which to operate.
keepdimsboolIf this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.
dtypeTypethe type expected as a return, null will remain the same dtype.
Returns
- NDArray
Minimum of a. If axis is None, the result is a scalar value. If axis is given, the result is an array of dimension a.ndim - 1.
Remarks
minimum(in NDArray, in NDArray, NDArray)
Element-wise minimum of array elements. Compare two arrays and returns a new array containing the element-wise minima.If one of the elements being compared is a NaN, then that element is returned.If both elements are NaNs then the first is returned.The latter distinction is important for complex NaNs, which are defined as at least one of the real or imaginary parts being a NaN. The net effect is that NaNs are propagated.
public static NDArray minimum(in NDArray x1, in NDArray x2, NDArray @out)
Parameters
x1NDArrayThe arrays holding the elements to be compared. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
x2NDArrayThe arrays holding the elements to be compared. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
outNDArray
Returns
- NDArray
The maximum of x1 and x2, element-wise. This is a scalar if both x1 and x2 are scalars.
minimum(in NDArray, in NDArray, NPTypeCode?)
Element-wise minimum of array elements. Compare two arrays and returns a new array containing the element-wise minima.If one of the elements being compared is a NaN, then that element is returned.If both elements are NaNs then the first is returned.The latter distinction is important for complex NaNs, which are defined as at least one of the real or imaginary parts being a NaN. The net effect is that NaNs are propagated.
public static NDArray minimum(in NDArray x1, in NDArray x2, NPTypeCode? outType = null)
Parameters
x1NDArrayThe arrays holding the elements to be compared. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
x2NDArrayThe arrays holding the elements to be compared. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
outTypeNPTypeCode?
Returns
- NDArray
The maximum of x1 and x2, element-wise. This is a scalar if both x1 and x2 are scalars.
minimum(in NDArray, in NDArray, Type)
Element-wise minimum of array elements. Compare two arrays and returns a new array containing the element-wise minima.If one of the elements being compared is a NaN, then that element is returned.If both elements are NaNs then the first is returned.The latter distinction is important for complex NaNs, which are defined as at least one of the real or imaginary parts being a NaN. The net effect is that NaNs are propagated.
public static NDArray minimum(in NDArray x1, in NDArray x2, Type outType)
Parameters
x1NDArrayThe arrays holding the elements to be compared. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
x2NDArrayThe arrays holding the elements to be compared. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
outTypeType
Returns
- NDArray
The maximum of x1 and x2, element-wise. This is a scalar if both x1 and x2 are scalars.
mintypecode(char[], string, char)
Return the character for the minimum-size type to which given types can be safely cast. The returned type character must represent the smallest size dtype such that an array of the returned type can handle the data from an array of all types in typechars(or if typechars is an array, then its dtype.char).
public static char mintypecode(char[] typechars, string typeset = "GDFgdf", char @default = 'd')
Parameters
typecharschar[]typesetstringThe set of characters that the returned character is chosen from. The default set is ‘GDFgdf’.
defaultcharThe default character, this is returned if none of the characters in typechars matches a character in typeset.
Returns
- char
The character representing the minimum-size type that was found.
mintypecode(string, string, char)
Return the character for the minimum-size type to which given types can be safely cast. The returned type character must represent the smallest size dtype such that an array of the returned type can handle the data from an array of all types in typechars(or if typechars is an array, then its dtype.char).
public static char mintypecode(string typechars, string typeset = "GDFgdf", char @default = 'd')
Parameters
typecharsstringevery character represents a type. see char
typesetstringThe set of characters that the returned character is chosen from. The default set is ‘GDFgdf’.
defaultcharThe default character, this is returned if none of the characters in typechars matches a character in typeset.
Returns
- char
The character representing the minimum-size type that was found.
mod(in NDArray, in NDArray)
public static NDArray mod(in NDArray x1, in NDArray x2)
Parameters
Returns
Remarks
mod(in NDArray, in float)
public static NDArray mod(in NDArray x1, in float x2)
Parameters
Returns
modf(in NDArray, NPTypeCode?)
Return the fractional and integral parts of an array, element-wise. The fractional and integral parts are negative if the given number is negative.
public static (NDArray Fractional, NDArray Intergral) modf(in NDArray x, NPTypeCode? outType = null)
Parameters
xNDArrayInput array.
outTypeNPTypeCode?The dtype the returned ndarray should be of, only non integer values are supported.
Returns
Remarks
modf(in NDArray, Type)
Return the fractional and integral parts of an array, element-wise. The fractional and integral parts are negative if the given number is negative.
public static (NDArray Fractional, NDArray Intergral) modf(in NDArray x, Type outType)
Parameters
xNDArrayInput array.
outTypeTypeThe dtype the returned ndarray should be of, only non integer values are supported.
Returns
Remarks
moveaxis(in NDArray, int, int)
Move axes of an array to new positions. Other axes remain in their original order.
public static NDArray moveaxis(in NDArray a, int source, int destination)
Parameters
aNDArrayThe array whose axes should be reordered.
sourceintOriginal positions of the axes to move. These must be unique (distinct).
destinationintDestination positions for each of the original axes. These must also be unique (distinct).
Returns
- NDArray
Array with moved axes.
Remarks
moveaxis(in NDArray, int, int[])
Move axes of an array to new positions. Other axes remain in their original order.
public static NDArray moveaxis(in NDArray a, int source, int[] destination)
Parameters
aNDArrayThe array whose axes should be reordered.
sourceintOriginal positions of the axes to move. These must be unique (distinct).
destinationint[]Destination positions for each of the original axes. These must also be unique (distinct).
Returns
- NDArray
Array with moved axes.
Remarks
moveaxis(in NDArray, int[], int)
Move axes of an array to new positions. Other axes remain in their original order.
public static NDArray moveaxis(in NDArray a, int[] source, int destination)
Parameters
aNDArrayThe array whose axes should be reordered.
sourceint[]Original positions of the axes to move. These must be unique (distinct).
destinationintDestination positions for each of the original axes. These must also be unique (distinct).
Returns
- NDArray
Array with moved axes.
Remarks
moveaxis(in NDArray, int[], int[])
Move axes of an array to new positions. Other axes remain in their original order.
public static NDArray moveaxis(in NDArray a, int[] source, int[] destination)
Parameters
aNDArrayThe array whose axes should be reordered.
sourceint[]Original positions of the axes to move. These must be unique (distinct).
destinationint[]Destination positions for each of the original axes. These must also be unique (distinct).
Returns
- NDArray
Array with moved axes.
Remarks
multiply(in NDArray, in NDArray)
public static NDArray multiply(in NDArray x1, in NDArray x2)
Parameters
Returns
Remarks
ndarray(Shape, Type, Array, char)
public static NDArray ndarray(Shape shape, Type dtype = null, Array buffer = null, char order = 'F')
Parameters
Returns
negative(in NDArray)
Numerical negative, element-wise.
public static NDArray negative(in NDArray nd)
Parameters
ndNDArray
Returns
Remarks
nonzero(in NDArray)
Return the indices of the elements that are non-zero. Returns a tuple of arrays, one for each dimension of a, containing the indices of the non-zero elements in that dimension.The values in a are always tested and returned in row-major, C-style order. To group the indices by element, rather than dimension, use argwhere, which returns a row for each non-zero element.
public static NDArray<int>[] nonzero(in NDArray a)
Parameters
aNDArrayInput array.
Returns
Remarks
ones(Shape)
Return a new array of given shape and type, filled with ones.
public static NDArray ones(Shape shape)
Parameters
shapeShapeShape of the new array.
Returns
Remarks
ones(Shape, NPTypeCode)
Return a new array of given shape and type, filled with ones.
public static NDArray ones(Shape shape, NPTypeCode typeCode)
Parameters
shapeShapeShape of the new array.
typeCodeNPTypeCodeThe desired data-type for the array, e.g., uint8. Default is float64 / double.
Returns
Remarks
ones(Shape, Type)
Return a new array of given shape and type, filled with ones.
public static NDArray ones(Shape shape, Type dtype)
Parameters
shapeShapeShape of the new array.
dtypeTypeThe desired data-type for the array, e.g., uint8. Default is float64 / double.
Returns
Remarks
ones(params int[])
Return a new array of given shape and type, filled with ones.
public static NDArray ones(params int[] shapes)
Parameters
shapesint[]Shape of the new array.
Returns
Remarks
ones(Type, params int[])
Return a new array of given shape and type, filled with ones.
public static NDArray ones(Type dtype = null, params int[] shapes)
Parameters
dtypeTypeThe desired data-type for the array, e.g., uint8. Default is float64 / double.
shapesint[]Shape of the new array.
Returns
Remarks
ones_like(NDArray, Type)
Return an array of ones with the same shape and type as a given array.
public static NDArray ones_like(NDArray a, Type dtype = null)
Parameters
aNDArrayArray of ones with the same shape and type as a.
dtypeTypeOverrides the data type of the result.
Returns
- NDArray
Array of zeros with the same shape and type as
nd.
Remarks
ones<T>(params int[])
Return a new array of given shape and type, filled with ones.
public static NDArray ones<T>(params int[] shapes) where T : unmanaged
Parameters
shapesint[]Shape of the new array.
Returns
Type Parameters
Remarks
outer(in NDArray, in NDArray)
Compute the outer product of two vectors. Given two vectors, a = [a0, a1, ..., aM] and b = [b0, b1, ..., bN], the outer product[R60] is:
public static NDArray outer(in NDArray a, in NDArray b)
Parameters
aNDArrayFirst input vector. Input is flattened if not already 1-dimensional.
bNDArraySecond input vector. Input is flattened if not already 1-dimensional.
Returns
- NDArray
out[i, j] = a[i] * b[j]
Remarks
positive(in NDArray)
Numerical positive, element-wise.
public static NDArray positive(in NDArray nd)
Parameters
ndNDArray
Returns
Remarks
power(in NDArray, in ValueType)
First array elements raised to powers from second array, element-wise.
public static NDArray power(in NDArray x1, in ValueType x2)
Parameters
Returns
- NDArray
The bases in x1 raised to the exponents in x2. This is a scalar NDArray if both x1 and x2 are scalars.
Remarks
power(in NDArray, in ValueType, NPTypeCode)
First array elements raised to powers from second array, element-wise.
public static NDArray power(in NDArray x1, in ValueType x2, NPTypeCode typeCode)
Parameters
x1NDArrayThe bases.
x2ValueTypeThe exponents.
typeCodeNPTypeCodeThe dtype of the returned NDArray
Returns
- NDArray
The bases in x1 raised to the exponents in x2. This is a scalar NDArray if both x1 and x2 are scalars.
Remarks
power(in NDArray, in ValueType, Type)
First array elements raised to powers from second array, element-wise.
public static NDArray power(in NDArray x1, in ValueType x2, Type dtype)
Parameters
Returns
- NDArray
The bases in x1 raised to the exponents in x2. This is a scalar NDArray if both x1 and x2 are scalars.
Remarks
prod(in NDArray, int?, Type, bool)
Return the product of array elements over a given axis.
public static NDArray prod(in NDArray a, int? axis = null, Type dtype = null, bool keepdims = false)
Parameters
aNDArrayInput data.
axisint?Axis or axes along which a product is performed. The default, axis=None, will calculate the product of all the elements in the input array. If axis is negative it counts from the last to the first axis.
dtypeTypeThe type of the returned array, as well as of the accumulator in which the elements are multiplied. The dtype of a is used by default unless a has an integer dtype of less precision than the default platform integer. In that case, if a is signed then the platform integer is used while if a is unsigned then an unsigned integer of the same precision as the platform integer is used.
keepdimsboolIf this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.
Returns
- NDArray
An array shaped as a but with the specified axis removed.
Remarks
ravel(NDArray)
Return a contiguous flattened array. A 1-D array, containing the elements of the input, is returned
public static NDArray ravel(NDArray a)
Parameters
aNDArrayInput array. The elements in a are read in the order specified by order, and packed as a 1-D array.
Returns
Remarks
repeat(NDArray, int)
Repeat elements of an array.
public static NDArray repeat(NDArray a, int repeats)
Parameters
aNDArrayInput array.
repeatsintThe number of repetitions for each element. repeats is broadcasted to fit the shape of the given axis.
Returns
Remarks
repeat<T>(T, int)
Repeat a scalar.
public static NDArray repeat<T>(T a, int repeats) where T : unmanaged
Parameters
aTInput scalar.
repeatsintThe number of repetitions for each element. repeats is broadcasted to fit the shape of the given axis.
Returns
Type Parameters
T
Remarks
reshape(NDArray, Shape)
Gives a new shape to an array without changing its data.
public static NDArray reshape(NDArray nd, Shape shape)
Parameters
ndNDArrayArray to be reshaped.
shapeShapeThe new shape should be compatible with the original shape.
Returns
- NDArray
original
ndreshaped without copying.
Remarks
reshape(NDArray, ref Shape)
Gives a new shape to an array without changing its data.
public static NDArray reshape(NDArray nd, ref Shape shape)
Parameters
ndNDArrayArray to be reshaped.
shapeShapeThe new shape should be compatible with the original shape.
Returns
- NDArray
original
ndreshaped without copying.
Remarks
reshape(NDArray, params int[])
Gives a new shape to an array without changing its data.
public static NDArray reshape(NDArray nd, params int[] shape)
Parameters
ndNDArrayArray to be reshaped.
shapeint[]The new shape should be compatible with the original shape.
Returns
- NDArray
original
ndreshaped without copying.
Remarks
roll(NDArray, int, int?)
Roll array elements along a given axis.
Elements that roll beyond the last position are re-introduced at the first.
public static NDArray roll(NDArray a, int shift, int? axis = null)
Parameters
aNDArrayInput array.
shiftintThe number of places by which elements are shifted.
axisint?Axis along which elements are shifted. By default, the array is flattened before shifting, after which the original shape is restored.
Returns
- NDArray
Output array, with the same shape as
a.
Remarks
Matches NumPy's algorithm: empty_like + slice-copy pairs. https://numpy.org/doc/stable/reference/generated/numpy.roll.html
rollaxis(in NDArray, int, int)
Roll the specified axis backwards, until it lies in a given position.
This function continues to be supported for backward compatibility, but you should prefer moveaxis. The moveaxis function was added in NumPy 1.11.
public static NDArray rollaxis(in NDArray a, int axis, int start = 0)
Parameters
aNDArrayInput array.
axisintThe axis to roll backwards. The positions of the other axes do not change relative to one another.
startintThe axis is rolled until it lies before this position. The default, 0, results in a “complete” roll.
Returns
Remarks
round_(in NDArray, int, NPTypeCode?)
Evenly round to the given number of decimals.
public static NDArray round_(in NDArray x, int decimals, NPTypeCode? outType = null)
Parameters
xNDArrayInput array
decimalsintNumber of decimal places to round to
outTypeNPTypeCode?The dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
An array of the same type as a, containing the rounded values. Unless out was specified, a new array is created. A reference to the result is returned. The real and imaginary parts of complex numbers are rounded separately.The result of rounding a float is a float.
Remarks
round_(in NDArray, int, Type)
Evenly round to the given number of decimals.
public static NDArray round_(in NDArray x, int decimals, Type outType)
Parameters
xNDArrayInput array
decimalsintNumber of decimal places to round to
outTypeTypeThe dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
An array of the same type as a, containing the rounded values. Unless out was specified, a new array is created. A reference to the result is returned. The real and imaginary parts of complex numbers are rounded separately.The result of rounding a float is a float.
Remarks
round_(in NDArray, NPTypeCode?)
Evenly round to the given number of decimals.
public static NDArray round_(in NDArray x, NPTypeCode? outType = null)
Parameters
xNDArrayInput array
outTypeNPTypeCode?The dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
An array of the same type as a, containing the rounded values. Unless out was specified, a new array is created. A reference to the result is returned. The real and imaginary parts of complex numbers are rounded separately.The result of rounding a float is a float.
Remarks
round_(in NDArray, Type)
Evenly round to the given number of decimals.
public static NDArray round_(in NDArray x, Type outType)
Parameters
xNDArrayInput array
outTypeTypeThe dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
An array of the same type as a, containing the rounded values. Unless out was specified, a new array is created. A reference to the result is returned. The real and imaginary parts of complex numbers are rounded separately.The result of rounding a float is a float.
Remarks
save(string, NDArray)
public static void save(string filepath, NDArray arr)
Parameters
save(string, Array)
public static void save(string filepath, Array arr)
Parameters
searchsorted(NDArray, NDArray)
Find indices where elements should be inserted to maintain order.
Find the indices into a sorted array a such that, if the corresponding elements in v were inserted before the indices, the order of a would be preserved.
public static NDArray searchsorted(NDArray a, NDArray v)
Parameters
Returns
- NDArray
Array of insertion points with the same shape as v.
Remarks
sign(in NDArray, NPTypeCode?)
public static NDArray sign(in NDArray x, NPTypeCode? outType = null)
Parameters
xNDArrayoutTypeNPTypeCode?
Returns
sign(in NDArray, Type)
public static NDArray sign(in NDArray x, Type outType)
Parameters
Returns
sin(in NDArray, NPTypeCode?)
Trigonometric sine, element-wise.
public static NDArray sin(in NDArray x, NPTypeCode? outType = null)
Parameters
xNDArrayAngle, in radians (2 \pi rad equals 360 degrees).
outTypeNPTypeCode?The dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
The sine of each element of x. This is a scalar if x is a scalar.
Remarks
sin(in NDArray, Type)
Trigonometric sine, element-wise.
public static NDArray sin(in NDArray x, Type outType)
Parameters
xNDArrayAngle, in radians (2 \pi rad equals 360 degrees).
outTypeTypeThe dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
The sine of each element of x. This is a scalar if x is a scalar.
Remarks
sinh(in NDArray, NPTypeCode?)
Hyperbolic sine, element-wise.
Equivalent to 1/2 * (np.exp(x) - np.exp(-x)) or -1j * np.sin(1j*x).
public static NDArray sinh(in NDArray x, NPTypeCode? outType = null)
Parameters
xNDArrayInput array.
outTypeNPTypeCode?The dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
The sine of each element of x. This is a scalar if x is a scalar.
Remarks
sinh(in NDArray, Type)
Hyperbolic sine, element-wise.
Equivalent to 1/2 * (np.exp(x) - np.exp(-x)) or -1j * np.sin(1j*x).
public static NDArray sinh(in NDArray x, Type outType)
Parameters
xNDArrayInput array.
outTypeTypeThe dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
The sine of each element of x. This is a scalar if x is a scalar.
Remarks
size(NDArray, int?)
Return the number of elements along a given axis.
public static int size(NDArray a, int? axis = null)
Parameters
aNDArrayInput data.
axisint?Axis along which the elements are counted. By default, give the total number of elements.
Returns
- int
Number of elements along the specified axis.
Remarks
sqrt(in NDArray, NPTypeCode?)
Return the non-negative square-root of an array, element-wise.
public static NDArray sqrt(in NDArray x, NPTypeCode? outType = null)
Parameters
xNDArrayThe values whose square-roots are required.
outTypeNPTypeCode?The dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
An array of the same shape as x, containing the positive square-root of each element in x. If any element in x is complex, a complex array is returned (and the square-roots of negative reals are calculated). If all of the elements in x are real, so is y, with negative elements returning nan. If out was provided, y is a reference to it. This is a scalar if x is a scalar.
Remarks
sqrt(in NDArray, Type)
Return the non-negative square-root of an array, element-wise.
public static NDArray sqrt(in NDArray x, Type outType)
Parameters
xNDArrayThe values whose square-roots are required.
outTypeTypeThe dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
An array of the same shape as x, containing the positive square-root of each element in x. If any element in x is complex, a complex array is returned (and the square-roots of negative reals are calculated). If all of the elements in x are real, so is y, with negative elements returning nan. If out was provided, y is a reference to it. This is a scalar if x is a scalar.
Remarks
square(in NDArray)
Return the element-wise square of the input.
public static NDArray square(in NDArray x)
Parameters
xNDArrayInput data.
Returns
- NDArray
Element-wise x*x, of the same shape and dtype as x. Returns scalar if x is a scalar.
Remarks
squeeze(NDArray)
Remove single-dimensional entries from the shape of an array.
public static NDArray squeeze(NDArray a)
Parameters
aNDArrayInput data.
Returns
- NDArray
The input array, but with all or a subset of the dimensions of length 1 removed. This is always a itself or a view into a.
Remarks
squeeze(NDArray, int)
Remove single-dimensional entries from the shape of an array.
public static NDArray squeeze(NDArray a, int axis)
Parameters
aNDArrayInput data.
axisintSelects a subset of the single-dimensional entries in the shape. If an axis is selected with shape entry greater than one, an error is raised.
Returns
- NDArray
The input array, but with all or a subset of the dimensions of length 1 removed. This is always a itself or a view into a.
Remarks
Exceptions
- IncorrectShapeException
If axis is not None, and an axis being squeezed is not of length 1
squeeze(Shape)
Remove single-dimensional entries from a shape.
public static Shape squeeze(Shape shape)
Parameters
shapeShapeInput shape.
Returns
- Shape
The input array, but with all or a subset of the dimensions of length 1 removed. This is always a itself or a view into a.
Remarks
stack(NDArray[], int)
Join a sequence of arrays along a new axis. The axis parameter specifies the index of the new axis in the dimensions of the result. For example, if axis=0 it will be the first dimension and if axis=-1 it will be the last dimension.
public static NDArray stack(NDArray[] arrays, int axis = 0)
Parameters
arraysNDArray[]Each array must have the same shape.
axisintThe axis in the result array along which the input arrays are stacked.
Returns
- NDArray
The stacked array has one more dimension than the input arrays.
Remarks
std(NDArray, bool, int?, NPTypeCode?)
Compute the standard deviation along the specified axis. Returns the standard deviation, a measure of the spread of a distribution, of the array elements. The standard deviation is computed for the flattened array by default, otherwise over the specified axis.
public static NDArray std(NDArray a, bool keepdims = false, int? ddof = null, NPTypeCode? dtype = null)
Parameters
aNDArrayCalculate the standard deviation of these values.
keepdimsboolIf this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.
ddofint?Means Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of elements. By default ddof is zero.
dtypeNPTypeCode?
Returns
- NDArray
returns a new array containing the std values, otherwise a reference to the output array is returned.
Remarks
std(NDArray, int, bool, int?, NPTypeCode?)
Compute the standard deviation along the specified axis. Returns the standard deviation, a measure of the spread of a distribution, of the array elements. The standard deviation is computed for the flattened array by default, otherwise over the specified axis.
public static NDArray std(NDArray a, int axis, bool keepdims = false, int? ddof = null, NPTypeCode? dtype = null)
Parameters
aNDArrayCalculate the standard deviation of these values.
axisintAxis or axes along which the standard deviation is computed. The default is to compute the standard deviation of the flattened array.
keepdimsboolIf this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.
ddofint?Means Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of elements. By default ddof is zero.
dtypeNPTypeCode?
Returns
- NDArray
returns a new array containing the std values, otherwise a reference to the output array is returned.
Remarks
std(in NDArray, bool, int?)
Compute the standard deviation along the specified axis. Returns the standard deviation, a measure of the spread of a distribution, of the array elements. The standard deviation is computed for the flattened array by default, otherwise over the specified axis.
public static NDArray std(in NDArray a, bool keepdims, int? ddof = null)
Parameters
aNDArrayCalculate the standard deviation of these values.
keepdimsboolIf this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.
ddofint?Means Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of elements. By default ddof is zero.
Returns
- NDArray
returns a new array containing the std values, otherwise a reference to the output array is returned.
Remarks
std(in NDArray, int, NPTypeCode, bool, int?)
Compute the standard deviation along the specified axis. Returns the standard deviation, a measure of the spread of a distribution, of the array elements. The standard deviation is computed for the flattened array by default, otherwise over the specified axis.
public static NDArray std(in NDArray a, int axis, NPTypeCode type, bool keepdims = false, int? ddof = null)
Parameters
aNDArrayCalculate the standard deviation of these values.
axisintAxis or axes along which the standard deviation is computed. The default is to compute the standard deviation of the flattened array.
typeNPTypeCodekeepdimsboolIf this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.
ddofint?Means Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of elements. By default ddof is zero.
Returns
- NDArray
returns a new array containing the std values, otherwise a reference to the output array is returned.
Remarks
std(in NDArray, int, bool, int?)
Compute the standard deviation along the specified axis. Returns the standard deviation, a measure of the spread of a distribution, of the array elements. The standard deviation is computed for the flattened array by default, otherwise over the specified axis.
public static NDArray std(in NDArray a, int axis, bool keepdims, int? ddof = null)
Parameters
aNDArrayCalculate the standard deviation of these values.
axisintAxis or axes along which the standard deviation is computed. The default is to compute the standard deviation of the flattened array.
keepdimsboolIf this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.
ddofint?Means Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of elements. By default ddof is zero.
Returns
- NDArray
returns a new array containing the std values, otherwise a reference to the output array is returned.
Remarks
std(in NDArray, int, int?)
Compute the standard deviation along the specified axis. Returns the standard deviation, a measure of the spread of a distribution, of the array elements. The standard deviation is computed for the flattened array by default, otherwise over the specified axis.
public static NDArray std(in NDArray a, int axis, int? ddof = null)
Parameters
aNDArrayCalculate the standard deviation of these values.
axisintAxis or axes along which the standard deviation is computed. The default is to compute the standard deviation of the flattened array.
ddofint?Means Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of elements. By default ddof is zero.
Returns
- NDArray
returns a new array containing the std values, otherwise a reference to the output array is returned.
Remarks
std(in NDArray, int, Type, bool, int?)
Compute the standard deviation along the specified axis. Returns the standard deviation, a measure of the spread of a distribution, of the array elements. The standard deviation is computed for the flattened array by default, otherwise over the specified axis.
public static NDArray std(in NDArray a, int axis, Type dtype, bool keepdims = false, int? ddof = null)
Parameters
aNDArrayCalculate the standard deviation of these values.
axisintAxis or axes along which the standard deviation is computed. The default is to compute the standard deviation of the flattened array.
dtypeTypekeepdimsboolIf this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.
ddofint?Means Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of elements. By default ddof is zero.
Returns
- NDArray
returns a new array containing the std values, otherwise a reference to the output array is returned.
Remarks
std(in NDArray, int?)
Compute the standard deviation along the specified axis. Returns the standard deviation, a measure of the spread of a distribution, of the array elements. The standard deviation is computed for the flattened array by default, otherwise over the specified axis.
public static NDArray std(in NDArray a, int? ddof = null)
Parameters
aNDArrayCalculate the standard deviation of these values.
ddofint?Means Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of elements. By default ddof is zero.
Returns
- NDArray
returns a new array containing the std values, otherwise a reference to the output array is returned.
Remarks
subtract(in NDArray, in NDArray)
public static NDArray subtract(in NDArray x1, in NDArray x2)
Parameters
Returns
Remarks
sum(in NDArray)
Sum of array elements over a given axis.
public static NDArray sum(in NDArray a)
Parameters
aNDArrayElements to sum.
Returns
- NDArray
An array with the same shape as a, with the specified axis removed. If a is a 0-d array, or if axis is None, a scalar is returned. If an output array is specified, a reference to out is returned.
Remarks
sum(in NDArray, bool)
Sum of array elements over a given axis.
public static NDArray sum(in NDArray a, bool keepdims)
Parameters
aNDArrayElements to sum.
keepdimsboolIf this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array. If the default value is passed, then keepdims will not be passed through to the sum method of sub-classes of ndarray, however any non-default value will be.If the sub-class’ method does not implement keepdims any exceptions will be raised.
Returns
- NDArray
An array with the same shape as a, with the specified axis removed. If a is a 0-d array, or if axis is None, a scalar is returned. If an output array is specified, a reference to out is returned.
Remarks
sum(in NDArray, int)
Sum of array elements over a given axis.
public static NDArray sum(in NDArray a, int axis)
Parameters
aNDArrayElements to sum.
axisintAxis or axes along which a sum is performed. The default, axis=None, will sum all of the elements of the input array. If axis is negative it counts from the last to the first axis.
Returns
- NDArray
An array with the same shape as a, with the specified axis removed. If a is a 0-d array, or if axis is None, a scalar is returned. If an output array is specified, a reference to out is returned.
Remarks
sum(in NDArray, NPTypeCode?)
Sum of array elements over a given axis.
public static NDArray sum(in NDArray a, NPTypeCode? typeCode)
Parameters
aNDArrayElements to sum.
typeCodeNPTypeCode?The type of the returned array and of the accumulator in which the elements are summed. The dtype of a is used by default unless a has an integer dtype of less precision than the default platform integer. In that case, if a is signed then the platform integer is used while if a is unsigned then an unsigned integer of the same precision as the platform integer is used.
Returns
- NDArray
An array with the same shape as a, with the specified axis removed. If a is a 0-d array, or if axis is None, a scalar is returned. If an output array is specified, a reference to out is returned.
Remarks
sum(in NDArray, int?, bool)
Sum of array elements over a given axis.
public static NDArray sum(in NDArray a, int? axis, bool keepdims)
Parameters
aNDArrayElements to sum.
axisint?Axis or axes along which a sum is performed. The default, axis=None, will sum all of the elements of the input array. If axis is negative it counts from the last to the first axis.
keepdimsboolIf this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array. If the default value is passed, then keepdims will not be passed through to the sum method of sub-classes of ndarray, however any non-default value will be.If the sub-class’ method does not implement keepdims any exceptions will be raised.
Returns
- NDArray
An array with the same shape as a, with the specified axis removed. If a is a 0-d array, or if axis is None, a scalar is returned. If an output array is specified, a reference to out is returned.
Remarks
sum(in NDArray, int?, bool, NPTypeCode?)
Sum of array elements over a given axis.
public static NDArray sum(in NDArray a, int? axis, bool keepdims, NPTypeCode? typeCode)
Parameters
aNDArrayElements to sum.
axisint?Axis or axes along which a sum is performed. The default, axis=None, will sum all of the elements of the input array. If axis is negative it counts from the last to the first axis.
keepdimsboolIf this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array. If the default value is passed, then keepdims will not be passed through to the sum method of sub-classes of ndarray, however any non-default value will be.If the sub-class’ method does not implement keepdims any exceptions will be raised.
typeCodeNPTypeCode?The type of the returned array and of the accumulator in which the elements are summed. The dtype of a is used by default unless a has an integer dtype of less precision than the default platform integer. In that case, if a is signed then the platform integer is used while if a is unsigned then an unsigned integer of the same precision as the platform integer is used.
Returns
- NDArray
An array with the same shape as a, with the specified axis removed. If a is a 0-d array, or if axis is None, a scalar is returned. If an output array is specified, a reference to out is returned.
Remarks
sum(in NDArray, int?, bool, Type)
Sum of array elements over a given axis.
public static NDArray sum(in NDArray a, int? axis, bool keepdims, Type dtype)
Parameters
aNDArrayElements to sum.
axisint?Axis or axes along which a sum is performed. The default, axis=None, will sum all of the elements of the input array. If axis is negative it counts from the last to the first axis.
keepdimsboolIf this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array. If the default value is passed, then keepdims will not be passed through to the sum method of sub-classes of ndarray, however any non-default value will be.If the sub-class’ method does not implement keepdims any exceptions will be raised.
dtypeTypeThe type of the returned array and of the accumulator in which the elements are summed. The dtype of a is used by default unless a has an integer dtype of less precision than the default platform integer. In that case, if a is signed then the platform integer is used while if a is unsigned then an unsigned integer of the same precision as the platform integer is used.
Returns
- NDArray
An array with the same shape as a, with the specified axis removed. If a is a 0-d array, or if axis is None, a scalar is returned. If an output array is specified, a reference to out is returned.
Remarks
sum(in NDArray, int?, NPTypeCode?)
Sum of array elements over a given axis.
public static NDArray sum(in NDArray a, int? axis, NPTypeCode? typeCode)
Parameters
aNDArrayElements to sum.
axisint?Axis or axes along which a sum is performed. The default, axis=None, will sum all of the elements of the input array. If axis is negative it counts from the last to the first axis.
typeCodeNPTypeCode?The type of the returned array and of the accumulator in which the elements are summed. The dtype of a is used by default unless a has an integer dtype of less precision than the default platform integer. In that case, if a is signed then the platform integer is used while if a is unsigned then an unsigned integer of the same precision as the platform integer is used.
Returns
- NDArray
An array with the same shape as a, with the specified axis removed. If a is a 0-d array, or if axis is None, a scalar is returned. If an output array is specified, a reference to out is returned.
Remarks
sum(in NDArray, int?, Type)
Sum of array elements over a given axis.
public static NDArray sum(in NDArray a, int? axis, Type dtype)
Parameters
aNDArrayElements to sum.
axisint?Axis or axes along which a sum is performed. The default, axis=None, will sum all of the elements of the input array. If axis is negative it counts from the last to the first axis.
dtypeTypeThe type of the returned array and of the accumulator in which the elements are summed. The dtype of a is used by default unless a has an integer dtype of less precision than the default platform integer. In that case, if a is signed then the platform integer is used while if a is unsigned then an unsigned integer of the same precision as the platform integer is used.
Returns
- NDArray
An array with the same shape as a, with the specified axis removed. If a is a 0-d array, or if axis is None, a scalar is returned. If an output array is specified, a reference to out is returned.
Remarks
sum(in NDArray, Type)
Sum of array elements over a given axis.
public static NDArray sum(in NDArray a, Type dtype)
Parameters
aNDArrayElements to sum.
dtypeTypeThe type of the returned array and of the accumulator in which the elements are summed. The dtype of a is used by default unless a has an integer dtype of less precision than the default platform integer. In that case, if a is signed then the platform integer is used while if a is unsigned then an unsigned integer of the same precision as the platform integer is used.
Returns
- NDArray
An array with the same shape as a, with the specified axis removed. If a is a 0-d array, or if axis is None, a scalar is returned. If an output array is specified, a reference to out is returned.
Remarks
swapaxes(in NDArray, int, int)
Interchange two axes of an array.
public static NDArray swapaxes(in NDArray a, int axis1, int axis2)
Parameters
Returns
Remarks
tan(in NDArray, NPTypeCode?)
Compute tangent element-wise.
Equivalent to np.sin(x)/np.cos(x) element-wise.
public static NDArray tan(in NDArray x, NPTypeCode? outType = null)
Parameters
xNDArrayAngle, in radians (2 \pi rad equals 360 degrees).
outTypeNPTypeCode?The dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
The sine of each element of x. This is a scalar if x is a scalar.
Remarks
tan(in NDArray, Type)
Trigonometric sine, element-wise.
public static NDArray tan(in NDArray x, Type outType)
Parameters
xNDArrayAngle, in radians (2 \pi rad equals 360 degrees).
outTypeTypeThe dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
The sine of each element of x. This is a scalar if x is a scalar.
Remarks
tanh(in NDArray, NPTypeCode?)
Compute hyperbolic tangent element-wise.
Equivalent to np.sinh(x)/np.cosh(x) or -1j * np.tan(1j*x).
public static NDArray tanh(in NDArray x, NPTypeCode? outType = null)
Parameters
xNDArrayInput array.
outTypeNPTypeCode?The dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
The sine of each element of x. This is a scalar if x is a scalar.
Remarks
tanh(in NDArray, Type)
Compute hyperbolic tangent element-wise.
Equivalent to np.sinh(x)/np.cosh(x) or -1j * np.tan(1j*x).
public static NDArray tanh(in NDArray x, Type outType)
Parameters
xNDArrayInput array.
outTypeTypeThe dtype the returned ndarray should be of, only non integer values are supported.
Returns
- NDArray
The sine of each element of x. This is a scalar if x is a scalar.
Remarks
transpose(in NDArray, int[])
Permute the dimensions of an array.
public static NDArray transpose(in NDArray a, int[] premute = null)
Parameters
aNDArrayInput array.
premuteint[]By default, reverse the dimensions, otherwise permute the axes according to the values given.
Returns
- NDArray
a with its axes permuted. A view is returned whenever possible.
Remarks
true_divide(in NDArray, in NDArray)
public static NDArray true_divide(in NDArray x1, in NDArray x2)
Parameters
Returns
Remarks
unique(in NDArray)
Find the unique elements of an array.
Returns the sorted unique elements of an array.There are three optional outputs in addition to the unique elements:
- the indices of the input array that give the unique values
- the indices of the unique array that reconstruct the input array
- the number of times each unique value comes up in the input array
public static NDArray unique(in NDArray a)
Parameters
aNDArray
Returns
- NDArray
The sorted unique values.
Remarks
var(NDArray, bool, int?, NPTypeCode?)
Compute the variance along the specified axis. Returns the variance of the array elements, a measure of the spread of a distribution. The variance is computed for the flattened array by default, otherwise over the specified axis.
public static NDArray var(NDArray a, bool keepdims = false, int? ddof = null, NPTypeCode? dtype = null)
Parameters
aNDArrayArray containing numbers whose variance is desired. If a is not an array, a conversion is attempted.
keepdimsboolIf this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.
ddofint?Means Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of elements. By default ddof is zero.
dtypeNPTypeCode?
Returns
- NDArray
returns a new array containing the var values, otherwise a reference to the output array is returned.
Remarks
var(NDArray, int, bool, int?, NPTypeCode?)
Compute the variance along the specified axis. Returns the variance of the array elements, a measure of the spread of a distribution. The variance is computed for the flattened array by default, otherwise over the specified axis.
public static NDArray var(NDArray a, int axis, bool keepdims = false, int? ddof = null, NPTypeCode? dtype = null)
Parameters
aNDArrayArray containing numbers whose variance is desired. If a is not an array, a conversion is attempted.
axisintAxis or axes along which the variance is computed. The default is to compute the variance of the flattened array.
keepdimsboolIf this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.
ddofint?Means Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of elements. By default ddof is zero.
dtypeNPTypeCode?
Returns
- NDArray
returns a new array containing the var values, otherwise a reference to the output array is returned.
Remarks
var(in NDArray, bool, int?)
Compute the variance along the specified axis. Returns the variance of the array elements, a measure of the spread of a distribution. The variance is computed for the flattened array by default, otherwise over the specified axis.
public static NDArray var(in NDArray a, bool keepdims, int? ddof = null)
Parameters
aNDArrayArray containing numbers whose variance is desired. If a is not an array, a conversion is attempted.
keepdimsboolIf this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.
ddofint?Means Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of elements. By default ddof is zero.
Returns
- NDArray
returns a new array containing the var values, otherwise a reference to the output array is returned.
Remarks
var(in NDArray, int, NPTypeCode, bool, int?)
Compute the variance along the specified axis. Returns the variance of the array elements, a measure of the spread of a distribution. The variance is computed for the flattened array by default, otherwise over the specified axis.
public static NDArray var(in NDArray a, int axis, NPTypeCode type, bool keepdims = false, int? ddof = null)
Parameters
aNDArrayArray containing numbers whose variance is desired. If a is not an array, a conversion is attempted.
axisintAxis or axes along which the variance is computed. The default is to compute the variance of the flattened array.
typeNPTypeCodekeepdimsboolIf this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.
ddofint?Means Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of elements. By default ddof is zero.
Returns
- NDArray
returns a new array containing the var values, otherwise a reference to the output array is returned.
Remarks
var(in NDArray, int, bool, int?)
Compute the variance along the specified axis. Returns the variance of the array elements, a measure of the spread of a distribution. The variance is computed for the flattened array by default, otherwise over the specified axis.
public static NDArray var(in NDArray a, int axis, bool keepdims, int? ddof = null)
Parameters
aNDArrayArray containing numbers whose variance is desired. If a is not an array, a conversion is attempted.
axisintAxis or axes along which the variance is computed. The default is to compute the variance of the flattened array.
keepdimsboolIf this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.
ddofint?Means Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of elements. By default ddof is zero.
Returns
- NDArray
returns a new array containing the var values, otherwise a reference to the output array is returned.
Remarks
var(in NDArray, int, int?)
Compute the variance along the specified axis. Returns the variance of the array elements, a measure of the spread of a distribution. The variance is computed for the flattened array by default, otherwise over the specified axis.
public static NDArray var(in NDArray a, int axis, int? ddof = null)
Parameters
aNDArrayArray containing numbers whose variance is desired. If a is not an array, a conversion is attempted.
axisintAxis or axes along which the variance is computed. The default is to compute the variance of the flattened array.
ddofint?Means Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of elements. By default ddof is zero.
Returns
- NDArray
returns a new array containing the var values, otherwise a reference to the output array is returned.
Remarks
var(in NDArray, int, Type, bool, int?)
Compute the variance along the specified axis. Returns the variance of the array elements, a measure of the spread of a distribution. The variance is computed for the flattened array by default, otherwise over the specified axis.
public static NDArray var(in NDArray a, int axis, Type dtype, bool keepdims = false, int? ddof = null)
Parameters
aNDArrayArray containing numbers whose variance is desired. If a is not an array, a conversion is attempted.
axisintAxis or axes along which the variance is computed. The default is to compute the variance of the flattened array.
dtypeTypekeepdimsboolIf this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.
ddofint?Means Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of elements. By default ddof is zero.
Returns
- NDArray
returns a new array containing the var values, otherwise a reference to the output array is returned.
Remarks
var(in NDArray, int?)
Compute the variance along the specified axis. Returns the variance of the array elements, a measure of the spread of a distribution. The variance is computed for the flattened array by default, otherwise over the specified axis.
public static NDArray var(in NDArray a, int? ddof = null)
Parameters
aNDArrayArray containing numbers whose variance is desired. If a is not an array, a conversion is attempted.
ddofint?Means Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of elements. By default ddof is zero.
Returns
- NDArray
returns a new array containing the var values, otherwise a reference to the output array is returned.
Remarks
vstack(params NDArray[])
Stack arrays in sequence vertically (row wise).
This is equivalent to concatenation along the first axis after 1-D arrays of shape(N,) have been reshaped to(1, N). Rebuilds arrays divided by vsplit.
public static NDArray vstack(params NDArray[] tup)
Parameters
tupNDArray[]The arrays must have the same shape along all but the first axis. 1-D arrays must have the same length.
Returns
- NDArray
The array formed by stacking the given arrays, will be at least 2-D.
Remarks
zeros(Shape)
Return a new double array of given shape, filled with zeros.
public static NDArray zeros(Shape shape)
Parameters
shapeShapeShape of the new array,
Returns
- NDArray
Array of zeros with the given shape, dtype.
Remarks
zeros(Shape, NPTypeCode)
Return a new double array of given shape, filled with zeros.
public static NDArray zeros(Shape shape, NPTypeCode typeCode)
Parameters
shapeShapeShape of the new array,
typeCodeNPTypeCodeThe desired data-type for the array, e.g., uint8. Default is float64 / double.
Returns
- NDArray
Array of zeros with the given shape, dtype.
Remarks
zeros(Shape, Type)
Return a new double array of given shape, filled with zeros.
public static NDArray zeros(Shape shape, Type dtype)
Parameters
shapeShapeShape of the new array,
dtypeTypeThe desired data-type for the array, e.g., uint8. Default is float64 / double.
Returns
- NDArray
Array of zeros with the given shape, dtype.
Remarks
zeros(params int[])
Return a new double array of given shape, filled with zeros.
public static NDArray zeros(params int[] shapes)
Parameters
shapesint[]Shape of the new array,
Returns
- NDArray
Array of zeros with the given shape, dtype.
Remarks
zeros_like(NDArray, Type)
Return an array of zeros with the same shape and type as a given array.
public static NDArray zeros_like(NDArray a, Type dtype = null)
Parameters
aNDArrayThe shape and data-type of a define these same attributes of the returned array.
dtypeTypeOverrides the data type of the result.
Returns
- NDArray
Array of zeros with the same shape and type as
nd.
Remarks
zeros<T>(params int[])
Return a new double array of given shape, filled with zeros.
public static NDArray zeros<T>(params int[] shapes) where T : unmanaged
Parameters
shapesint[]Shape of the new array,
Returns
- NDArray
Array of zeros with the given shape, type
T.
Type Parameters
T