rand.random_circulant_gram

Generate random circulant Gram matrix.

Module Contents

Functions

random_circulant_gram(dim)

Generate a random circulant Gram matrix of specified dimension.

rand.random_circulant_gram.random_circulant_gram(dim)

Generate a random circulant Gram matrix of specified dimension.

A circulant matrix is a square matrix where the elements of each row are identical to the elements of the previous row such that the elements in one row are relocated by 1 position (in a cyclic manner) compared to the previous row. The eigenvalues and eigenvectors of this matrix are derived from the Discrete Fourier Transform (DFT).

For more information on circulant matrices, see [1]. This function utilizes the normalized DFT, a variation of DFT with normalized basis vectors.

For additional information, see [2].

The function creates a circulant matrix from a random diagonal matrix and the normalized DFT matrix. First, it generates a diagonal matrix with random non-negative entries. Next, it constructs the normalized DFT matrix. Finally, it computes the circulant matrix, which is real due to its origin from the DFT of a real diagonal matrix.

Examples

Generate a random circulant Gram matrix of dimension 4.

>>> import numpy as np
>>> from toqito.rand import random_circulant_gram
>>> circulant_matrix = random_circulant_gram(4)
>>> circulant_matrix.shape
(4, 4)
>>> np.allclose(circulant_matrix, circulant_matrix.T)
True
>>> circulant_matrix  
array([[0.42351891, 0.21058986, 0.04257471, 0.21058986],
       [0.21058986, 0.42351891, 0.21058986, 0.04257471],
       [0.04257471, 0.21058986, 0.42351891, 0.21058986],
       [0.21058986, 0.04257471, 0.21058986, 0.42351891]])

References

[1]

Wikipedia. Circulant matrix. https://en.wikipedia.org/wiki/Circulant_matrix.

[2]

Stanford University CCRMA. Normalized dft. https://ccrma.stanford.edu/ jos/st/Normalized_DFT.html.

Parameters:

dim (int) – int The dimension of the circulant matrix to generate.

Returns:

numpy.ndarray A dim x dim real, symmetric, circulant matrix.

Return type:

numpy.ndarray