Memory2D<T> Structure

Represents a two-dimensional array stored in a memory block.

Definition

Namespace: Numerics.NET.Collections
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4
C#
public readonly struct Memory2D<T> : IStorage2D<T, MemorySlice<T>, Memory2D<T>>, 
	IStorage2D<T, Memory2D<T>>, IStorage2D<T>
Inheritance
Object  →  ValueType  →  Memory2D<T>
Implements
IStorage2D<T>, IStorage2D<T, Memory2D<T>>, IStorage2D<T, MemorySlice<T>, Memory2D<T>>

Type Parameters

T
The element type of the array.

Remarks

Use the Memory2D<T> structure to represent two-dimensional arrays in a format suitable for calling external libraries like BLAS and LAPACK. The two-dimensional array is stored in a linear block of memory. Columns are stored in contuguous blocks with a fixed number of elements between them.

Memory2D<T> objects do not have a size. The actual dimensions must be supplied separately.

  Caution

The Memory2D<T> type is meant for performance-critical code. No bounds checks or other validation is performed.

Constructors

Memory2D<T>(Int32, Int32, Boolean) Constructs a new array.
Memory2D<T>(Memory<T>, Int32, Int32) Constructs a new array.

Properties

Item Gets or sets the element at the specified position.
LeadingDimension Gets the number of elements between the start of successive columns.
Offset Gets the position of the first stored element in the array
Span2D Gets a 2D span over the elements of the array.

Return Value

A Span2D<T>.

Methods

AsSlice Returns the array as an array slice with unit leadingDimension.
Clear Sets the specified number of elements to their default value.
Clone Creates a deep copy of the array.
CloneData Returns a new contiguous 2D array with the specified elements of the current array.
Column Returns an array with offset that corresponds to a column in the array.
ColumnFrom Returns an array with offset that corresponds to a column in the array that starts at the specified position.
Diagonal Returns an array slice that corresponds to a column in the array.
EqualsIndicates whether this instance and a specified object are equal.
(Overrides ValueType.Equals(Object))
From(Int32, Int32) Returns the array starting at the specified position.
From(Int32, Int32, Int32) Returns the array starting at the specified position with the specified leading dimension.
GetHashCodeReturns the hash code for this instance.
(Overrides ValueType.GetHashCode())
GetIndex Gets the index in the storage array of the element at the specified position.
GetTypeGets the Type of the current instance.
(Inherited from Object)
Resize Returns a new array with the specified size and leading dimension. Elements are copied to the new array.
Row Returns the array slice that corresponds to a row in the array.
RowFrom Returns the array slice that corresponds to a row in the array that starts at the specified position.
SliceFrom Returns an array slice with a specified stride that starts at the specified position.
Span Gets a span over the elements of the array.

Return Value

A Span<T>.
ToStringReturns the fully qualified type name of this instance.
(Inherited from ValueType)
Transpose Transposes the elements of the 2D array and returns the result.
TransposeTo Transposes the elements of the 2D array and returns the result in the specified array.
WithLeadingDimension Returns the array at the current position with the specified leading dimension.

Operators

Equality(Memory2D<T>, Memory2D<T>) Checks whether two 2D arrays are equal.
Inequality(Memory2D<T>, Memory2D<T>) Checks whether two 2D arrays are not equal.

Fields

Empty Returns an empty 2D array.
Values Gets the storage array.

See Also