Table of Contents

Interface IArraySlice

Namespace
NumSharp.Backends.Unmanaged
Assembly
NumSharp.dll
public interface IArraySlice : IMemoryBlock, ICloneable, IEnumerable
Inherited Members
Extension Methods

Properties

this[long]

object this[long index] { get; set; }

Parameters

index long

Property Value

object

MemoryBlock

IMemoryBlock MemoryBlock { get; }

Property Value

IMemoryBlock

Methods

AsSpan<T>()

Returns an UnmanagedSpan representing this slice's memory.

UnmanagedSpan<T> AsSpan<T>() where T : unmanaged

Returns

UnmanagedSpan<T>

Type Parameters

T

Remarks

Does not perform copy. Supports long indexing for arrays > 2B elements.

Clone()

IArraySlice Clone()

Returns

IArraySlice

Clone<T>()

ArraySlice<T> Clone<T>() where T : unmanaged

Returns

ArraySlice<T>

Type Parameters

T

CopyTo<T>(UnmanagedSpan<T>)

Copies this slice's contents to an UnmanagedSpan destination. Supports long indexing for arrays > 2B elements.

void CopyTo<T>(UnmanagedSpan<T> destination) where T : unmanaged

Parameters

destination UnmanagedSpan<T>

Type Parameters

T

CopyTo<T>(Span<T>)

void CopyTo<T>(Span<T> destination)

Parameters

destination Span<T>

Type Parameters

T

DangerousFree()

Performs dispose on the internal unmanaged memory block.

void DangerousFree()

Remarks

Dangerous because this ArraySlice might be a IsSlice therefore there might be other slices that point to current MemoryBlock.
So releasing the MemoryBlock might cause memory corruption elsewhere.
It is best to leave MemoryBlock to GC.

Fill(object)

Fills all indexes with value.

void Fill(object value)

Parameters

value object

GetIndex(long)

object GetIndex(long index)

Parameters

index long

Returns

object

GetIndex<T>(long)

T GetIndex<T>(long index) where T : unmanaged

Parameters

index long

Returns

T

Type Parameters

T

GetPinnableReference<T>()

Gets pinnable reference of the first item in the memory block storage.

ref T GetPinnableReference<T>() where T : unmanaged

Returns

T

Type Parameters

T

SetIndex(long, object)

void SetIndex(long index, object value)

Parameters

index long
value object

SetIndex<T>(long, T)

void SetIndex<T>(long index, T value) where T : unmanaged

Parameters

index long
value T

Type Parameters

T

Slice(long)

Perform a slicing on this IMemoryBlock without copying data.

IArraySlice Slice(long start)

Parameters

start long

The index to start from

Returns

IArraySlice

Remarks

Creates a slice without copying.

Slice(long, long)

Perform a slicing on this IMemoryBlock without copying data.

IArraySlice Slice(long start, long count)

Parameters

start long

The index to start from

count long

The number of items to slice (not bytes)

Returns

IArraySlice

Remarks

Creates a slice without copying.

ToArray()

Copies this IArraySlice contents into a new array.

Array ToArray()

Returns

Array