Matrix.Create Toeplitz Method
Definition
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.1.0
Overload List
| Create | Creates a new dense symmetric Toeplitz matrix from the first column. |
| Create | Creates a new dense Toeplitz matrix from the first column and first row. |
CreateToeplitz<T>(ReadOnlySpan<T>, ArrayMutability)
public static DenseMatrix<T> CreateToeplitz<T>(
ReadOnlySpan<T> firstColumn,
ArrayMutability mutability = ArrayMutability.MutableValues
)
Parameters
- firstColumn ReadOnlySpan<T>
- A span containing the elements of the first column (which also defines the first row for a symmetric Toeplitz matrix).
- 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 symmetric Toeplitz structure.
Remarks
A symmetric Toeplitz matrix is a special case where the first row equals the first column, resulting in a symmetric matrix.
This method creates a dense representation of the Toeplitz matrix. For large matrices where memory efficiency and specialized operations are important, consider using the structured [!:ToeplitzMatrix<T>] type.
Example
// Create a 4x4 symmetric Toeplitz matrix
var col = new double[] { 1, 2, 3, 4 };
var matrix = Matrix.CreateToeplitz(col);
// Resulting matrix:
// [ 1 2 3 4 ]
// [ 2 1 2 3 ]
// [ 3 2 1 2 ]
// [ 4 3 2 1 ]CreateToeplitz<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, ArrayMutability)
public static DenseMatrix<T> CreateToeplitz<T>(
ReadOnlySpan<T> firstColumn,
ReadOnlySpan<T> firstRow,
ArrayMutability mutability = ArrayMutability.MutableValues
)
Parameters
- firstColumn ReadOnlySpan<T>
- A span containing the elements of the first column.
- 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 DenseMatrix<T> with the Toeplitz structure.
Remarks
A Toeplitz matrix is a matrix in which each descending diagonal from left to right is constant. The matrix is defined by its first column and first row.
This method creates a dense representation of the Toeplitz matrix. For large matrices where memory efficiency and specialized operations are important, consider using the structured [!:ToeplitzMatrix<T>] type.
The first element (top-left corner) must be the same in both firstColumn and firstRow. If they differ, an exception is thrown.
Example
// Create a 4x5 Toeplitz matrix
var col = new double[] { 1, 2, 3, 4 };
var row = new double[] { 1, 5, 6, 7, 8 };
var matrix = Matrix.CreateToeplitz(col, row);
// Resulting matrix:
// [ 1 5 6 7 8 ]
// [ 2 1 5 6 7 ]
// [ 3 2 1 5 6 ]
// [ 4 3 2 1 5 ]Exceptions
| Argument | The first element of firstColumn and firstRow are not equal. |