Table of Contents

Struct DenseMatrix<T>

Namespace
SixLabors.ImageSharp
Assembly
SixLabors.ImageSharp.dll

Represents a dense matrix with arbitrary elements. Components that are adjacent in a column of the matrix are adjacent in the storage array. The components are said to be stored in column major order.

public readonly struct DenseMatrix<T> : IEquatable<DenseMatrix<T>> where T : struct, IEquatable<T>

Type Parameters

T

The type of elements in the matrix.

Implements
Inherited Members

Constructors

DenseMatrix(int)

Initializes a new instance of the DenseMatrix<T> struct.

public DenseMatrix(int length)

Parameters

length int

The length of each side in the matrix.

DenseMatrix(int, int)

Initializes a new instance of the DenseMatrix<T> struct.

public DenseMatrix(int columns, int rows)

Parameters

columns int

The number of columns.

rows int

The number of rows.

DenseMatrix(int, int, Span<T>)

Initializes a new instance of the DenseMatrix<T> struct.

public DenseMatrix(int columns, int rows, Span<T> data)

Parameters

columns int

The number of columns.

rows int

The number of rows.

data Span<T>

The array to provide access to.

DenseMatrix(T[,])

Initializes a new instance of the DenseMatrix<T> struct.

public DenseMatrix(T[,] data)

Parameters

data T[,]

The 2D array to provide access to.

Properties

Columns

Gets the number of columns in the dense matrix.

public int Columns { get; }

Property Value

int

Count

Gets the number of items in the array.

public int Count { get; }

Property Value

int

Data

Gets the 1D representation of the dense matrix.

public T[] Data { get; }

Property Value

T[]

this[int, int]

Gets or sets the item at the specified position.

public ref T this[int row, int column] { get; }

Parameters

row int

The row-coordinate of the item. Must be greater than or equal to zero and less than the height of the array.

column int

The column-coordinate of the item. Must be greater than or equal to zero and less than the width of the array.

Property Value

T

The at the specified position.

Rows

Gets the number of rows in the dense matrix.

public int Rows { get; }

Property Value

int

Size

Gets the size of the dense matrix.

public Size Size { get; }

Property Value

Size

Span

Gets a span wrapping the Data.

public Span<T> Span { get; }

Property Value

Span<T>

Methods

Clear()

Clears the matrix setting each value to the default value for the element type

public void Clear()

Equals(DenseMatrix<T>)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(DenseMatrix<T> other)

Parameters

other DenseMatrix<T>

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

Fill(T)

Fills the matrix with the given value

public void Fill(T value)

Parameters

value T

The value to fill each item with

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

Transpose()

Transposes the rows and columns of the dense matrix.

public DenseMatrix<T> Transpose()

Returns

DenseMatrix<T>

The DenseMatrix<T>.

Operators

operator ==(DenseMatrix<T>, DenseMatrix<T>)

Compares the two DenseMatrix<T> instances to determine whether they are unequal.

public static bool operator ==(DenseMatrix<T> left, DenseMatrix<T> right)

Parameters

left DenseMatrix<T>

The first source instance.

right DenseMatrix<T>

The second source instance.

Returns

bool

The bool.

implicit operator T[,](in DenseMatrix<T>)

Performs an implicit conversion from a DenseMatrix<T> to a T[,].

public static implicit operator T[,](in DenseMatrix<T> data)

Parameters

data DenseMatrix<T>

The source array.

Returns

T[,]

The T[,] representation on the source data.

implicit operator DenseMatrix<T>(T[,])

Performs an implicit conversion from a T[,] to a DenseMatrix<T>.

public static implicit operator DenseMatrix<T>(T[,] data)

Parameters

data T[,]

The source array.

Returns

DenseMatrix<T>

The DenseMatrix<T> representation on the source data.

operator !=(DenseMatrix<T>, DenseMatrix<T>)

Compares the two DenseMatrix<T> instances to determine whether they are equal.

public static bool operator !=(DenseMatrix<T> left, DenseMatrix<T> right)

Parameters

left DenseMatrix<T>

The first source instance.

right DenseMatrix<T>

The second source instance.

Returns

bool

The bool.