Matrix.CreateCirculant<T> Method

Creates a new dense circulant matrix from the first row.

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0
C#
public static DenseMatrix<T> CreateCirculant<T>(
	ReadOnlySpan<T> firstRow,
	ArrayMutability mutability = ArrayMutability.MutableValues
)

Parameters

firstRow  ReadOnlySpan<T>
A span containing the elements of the first row.
mutability  ArrayMutability  (Optional)
Specifies how the matrix's values may be changed. The default is mutable values.

Type Parameters

T
The element type of the matrix.

Return Value

DenseMatrix<T>
A new square DenseMatrix<T> with the circulant structure.

Remarks

A circulant matrix is a special kind of Toeplitz matrix where each row is a cyclic right shift of the previous row. It is fully determined by its first row.

Circulant matrices have special properties: they are diagonalized by the discrete Fourier transform, making certain operations very efficient.

Example

// Create a 4x4 circulant matrix var row = new double[] { 1, 2, 3, 4 }; var matrix = Matrix.CreateCirculant(row); // Resulting matrix: // [ 1 2 3 4 ] // [ 4 1 2 3 ] // [ 3 4 1 2 ] // [ 2 3 4 1 ]

See Also