imate.sample_matrices.toeplitz_trace#
- imate.sample_matrices.toeplitz_trace(a, b, size, gram=False)#
Compute the trace of the Toeplitz matrix using an analytic formula.
The Toeplitz matrix using the entries \(a\) and \(b\) refers to the matrix generated by
imate.toeplitz()
.- Parameters:
- afloat
The diagonal elements of the Toeplitz matrix.
- bfloat
The upper off-diagonal elements of the Toeplitz matrix.
- sizeint, default=20
Size of the square matrix.
- grambool, default=False
If False, the matrix is assumed to be bi-diagonal Toeplitz. If True, the Gramian of the matrix is considered instead.
- Returns:
- tracefloat
Trace of Toeplitz matrix
See also
Notes
For the matrix \(\mathbf{A}\) given in
imate.toeplitz()
, the trace is computed by\[\mathrm{trace}(\mathbf{A}) = n a,\]where \(n\) is the size of the matrix. For the Gramian matrix, \(\mathbf{B} = \mathbf{A}^{\intercal} \mathbf{A}\) (when
gram
is set to True), the trace is\[\mathrm{trace}(\mathbf{B}) = a^2 + (n-1)(a^2 + b^2).\]Examples
>>> from imate.sample_matrices import toeplitz_trace >>> a, b = 2, 3 >>> toeplitz_trace(a, b, size=6) 12 >>> toeplitz_trace(a, b, size=6, gram=True) 69