Table of Contents

Namespace NumSharp

Classes

AxisError

NumPy-compatible AxisError exception. Raised when an axis argument is out of bounds for the array's dimensions.

AxisOutOfRangeException
DType
IncorrectShapeException
IncorrectSizeException
IncorrectTypeException
IndexError

Exception that corresponds to Python/NumPy's IndexError. Raised when a sequence subscript is out of range, or when an index type is invalid (e.g. float/complex index on an ndarray).

Kwargs
MT19937

Mersenne Twister MT19937 pseudo-random number generator. This implementation matches NumPy's MT19937 exactly, producing identical sequences for the same seed.

MethodImplOptionsConstants

Method implementation option constants for use with MethodImplAttribute.

MultiIterator
NDArray

Container protocol implementation for NDArray. Provides Python-compatible container protocol methods: contains, hash, len, iter, getitem, setitem

NDIteratorExtensions
NDIterator<TOut>
NPTypeCodeExtensions
NpzDictionary
NpzDictionary<T>
NumPyRandom

A class that serves as numpy.random.RandomState in python. Uses MT19937 (Mersenne Twister) for NumPy-compatible random number generation.

NumSharpException
Slice

NDArray can be indexed using slicing
A slice is constructed by start:stop:step notation

Examples:

a[start:stop] # items start through stop-1
a[start:] # items start through the rest of the array
a[:stop] # items from the beginning through stop-1

The key point to remember is that the :stop value represents the first value that is not
in the selected slice. So, the difference between stop and start is the number of elements
selected (if step is 1, the default).

There is also the step value, which can be used with any of the above:
a[:] # a copy of the whole array
a[start:stop:step] # start through not past stop, by step

The other feature is that start or stop may be a negative number, which means it counts
from the end of the array instead of the beginning. So:
a[-1] # last item in the array
a[-2:] # last two items in the array
a[:-2] # everything except the last two items
Similarly, step may be a negative number:

a[::- 1] # all items in the array, reversed
a[1::- 1] # the first two items, reversed
a[:-3:-1] # the last two items, reversed
a[-3::- 1] # everything except the last two items, reversed

NumSharp is kind to the programmer if there are fewer items than
you ask for. For example, if you ask for a[:-2] and a only contains one element, you get an
empty list instead of an error.Sometimes you would prefer the error, so you have to be aware
that this may happen.

Adapted from Greg Hewgill's answer on Stackoverflow: https://stackoverflow.com/questions/509211/understanding-slice-notation

Note: special IsIndex == true
It will pick only a single value at Start in this dimension effectively reducing the Shape of the sliced matrix by 1 dimension.
It can be used to reduce an N-dimensional array/matrix to a (N-1)-dimensional array/matrix

Example:
a=[[1, 2], [3, 4]]
a[:, 1] returns the second column of that 2x2 matrix as a 1-D vector
TensorEngine
TypeError

Exception that corresponds to Python/NumPy's TypeError. Raised when an operation or function receives an argument of inappropriate type.

ValueError

NumPy-compatible ValueError exception. Raised when an operation receives an argument with the right type but inappropriate value.

finfo

Machine limits for floating point types.

iinfo

Machine limits for integer types.

np

API bridge between NumSharp and Python NumPy

np.Broadcast

Structs

DateTime64

A 64-bit signed tick count representing a date/time value with full long range and a NaT sentinel, matching NumPy's np.datetime64 semantics. Used as a conversion-helper type in Converts.

NDArray._Unsafe
NDArray._Unsafe._Pinning
NativeRandomState

Represents the stored state of MT19937 random number generator. This format is compatible with NumPy's random state.

Shape

Broadcasting operations for Shape.

SliceDef

Interfaces

IIndex

Represents a class that can be served as an index, e.g. ndarray[new Slice(...)]

INumSharpException
NDIterator

Enums

ArrayFlags

NumPy-aligned array flags. Cached at shape creation for O(1) access. Matches numpy/core/include/numpy/ndarraytypes.h flag definitions.

BackendType
IteratorType
NPTypeCode

Represents all available types in numpy.

NPTypeKind

Abstract type categories in NumPy's type hierarchy. These mirror NumPy's abstract scalar types (np.generic, np.number, etc.)

Delegates

MoveNextReferencedDelegate<T>