Struct DenseMatrix<T>
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.
Implements
Inherited Members
Namespace: SixLabors.ImageSharp
Assembly: SixLabors.ImageSharp.dll
Syntax
public readonly struct DenseMatrix<T> : IEquatable<DenseMatrix<T>> where T : struct, IEquatable<T>
Type Parameters
Name | Description |
---|---|
T | The type of elements in the matrix. |
Constructors
| Improve this Doc View SourceDenseMatrix(T[,])
Initializes a new instance of the DenseMatrix<T> struct.
Declaration
public DenseMatrix(T[, ] data)
Parameters
Type | Name | Description |
---|---|---|
T[,] | data | The 2D array to provide access to. |
DenseMatrix(Int32)
Initializes a new instance of the DenseMatrix<T> struct.
Declaration
public DenseMatrix(int length)
Parameters
Type | Name | Description |
---|---|---|
Int32 | length | The length of each side in the matrix. |
DenseMatrix(Int32, Int32)
Initializes a new instance of the DenseMatrix<T> struct.
Declaration
public DenseMatrix(int columns, int rows)
Parameters
Type | Name | Description |
---|---|---|
Int32 | columns | The number of columns. |
Int32 | rows | The number of rows. |
Fields
| Improve this Doc View SourceColumns
Gets the number of columns in the dense matrix.
Declaration
public readonly int Columns
Field Value
Type | Description |
---|---|
Int32 |
Count
Gets the number of items in the array.
Declaration
public readonly int Count
Field Value
Type | Description |
---|---|
Int32 |
Data
The 1D representation of the dense matrix.
Declaration
public readonly T[] Data
Field Value
Type | Description |
---|---|
T[] |
Rows
Gets the number of rows in the dense matrix.
Declaration
public readonly int Rows
Field Value
Type | Description |
---|---|
Int32 |
Size
Gets the size of the dense matrix.
Declaration
public readonly Size Size
Field Value
Type | Description |
---|---|
Size |
Properties
| Improve this Doc View SourceItem[Int32, Int32]
Gets or sets the item at the specified position.
Declaration
public readonly ref T this[int row, int column] { get; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | row | The row-coordinate of the item. Must be greater than or equal to zero and less than the height of the array. |
Int32 | column | The column-coordinate of the item. Must be greater than or equal to zero and less than the width of the array. |
Property Value
Type | Description |
---|---|
T | The |
Span
Gets a span wrapping the Data.
Declaration
public readonly Span<T> Span { get; }
Property Value
Type | Description |
---|---|
Span<T> |
Methods
| Improve this Doc View SourceClear()
Clears the matrix setting each value to the default value for the element type
Declaration
public readonly void Clear()
Equals(DenseMatrix<T>)
Declaration
public readonly bool Equals(DenseMatrix<T> other)
Parameters
Type | Name | Description |
---|---|---|
DenseMatrix<T> | other |
Returns
Type | Description |
---|---|
Boolean |
Equals(Object)
Declaration
public override readonly bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj |
Returns
Type | Description |
---|---|
Boolean |
Overrides
| Improve this Doc View SourceFill(T)
Fills the matrix with the given value
Declaration
public readonly void Fill(T value)
Parameters
Type | Name | Description |
---|---|---|
T | value | The value to fill each item with |
GetHashCode()
Declaration
public override readonly int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
Overrides
| Improve this Doc View SourceTranspose()
Transposes the rows and columns of the dense matrix.
Declaration
public readonly DenseMatrix<T> Transpose()
Returns
Type | Description |
---|---|
DenseMatrix<T> | The DenseMatrix<T>. |
Operators
| Improve this Doc View SourceEquality(DenseMatrix<T>, DenseMatrix<T>)
Compares the two DenseMatrix<T> instances to determine whether they are unequal.
Declaration
public static bool operator ==(DenseMatrix<T> left, DenseMatrix<T> right)
Parameters
Type | Name | Description |
---|---|---|
DenseMatrix<T> | left | The first source instance. |
DenseMatrix<T> | right | The second source instance. |
Returns
Type | Description |
---|---|
Boolean | The Boolean. |
Implicit(T[,] to DenseMatrix<T>)
Performs an implicit conversion from a T[,] to a DenseMatrix<T>.
Declaration
public static implicit operator DenseMatrix<T>(T[, ] data)
Parameters
Type | Name | Description |
---|---|---|
T[,] | data | The source array. |
Returns
Type | Description |
---|---|
DenseMatrix<T> | The DenseMatrix<T> representation on the source data. |
Implicit(in DenseMatrix<T> to T[,])
Performs an implicit conversion from a DenseMatrix<T> to a T[,].
Declaration
public static implicit operator T[, ](in DenseMatrix<T> data)
Parameters
Type | Name | Description |
---|---|---|
DenseMatrix<T> | data | The source array. |
Returns
Type | Description |
---|---|
T[,] | The T[,] representation on the source data. |
Inequality(DenseMatrix<T>, DenseMatrix<T>)
Compares the two DenseMatrix<T> instances to determine whether they are equal.
Declaration
public static bool operator !=(DenseMatrix<T> left, DenseMatrix<T> right)
Parameters
Type | Name | Description |
---|---|---|
DenseMatrix<T> | left | The first source instance. |
DenseMatrix<T> | right | The second source instance. |
Returns
Type | Description |
---|---|
Boolean | The Boolean. |